DEV Community 👩‍💻👨‍💻

Cover image for Selenium Webdriver for Automation
Damon Marc Rocha II
Damon Marc Rocha II

Posted on

Selenium Webdriver for Automation

So I recently wanted to create an application to automate the job application process. This project is still a work in progress and was really just meant to be a break from what I have been working on. Using selenium and Monster's easy application process, I got my program to apply to various speed-apply jobs.


First I imported requests and webdriver from selenium. Then got the monster job URL for software jobs in texas and passed it into my chrome driver

import requests
from selenium import webdriver
URL = ''
driver = webdriver.Chrome(chromedriver_location)
Enter fullscreen mode Exit fullscreen mode

Then the program logged me in using the code below:

driver.find_element_by_tag_name("ul a").click()
Enter fullscreen mode Exit fullscreen mode

Job Application

When I first started this I tried to go through each application and have the program fill in my information and apply. This worked well for one job but the driver was slower than the code and caused some issues. So I decided to just select the speed-apply jobs and apply to these. However, the issue then arose that the page some times had different numbers of jobs so I implemented the solution below:

for num in range(0, 50):
        jobs = driver.find_elements_by_tag_name('h2 a')
        jobs = driver.find_elements_by_tag_name('h2 a')
        apply = driver.find_element_by_id('speedApply')
        if apply:
            print(f"applied to job {num}")
        print(f"job {num}")
        print("Gotta do more")
Enter fullscreen mode Exit fullscreen mode

In this code, I go through 50 jobs(Sometimes). If there are no more jobs the program then presses the more jobs button. Once these results are loaded the program will try to continue through the process. This works for the most part but as of now, I am running into issues with some of the speed applies.

With this, I have successfully applied for a handful of jobs on Monster using Selenium and python code.

Top comments (2)

derekjhopper profile image
Derek Hopper

This is awesome. Clever use of Selenium.

dmarcr1997 profile image
Damon Marc Rocha II Author

Thanks Derek

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.