Skip to content
Go back

Test Automation - Selenium Example Python Project 2022 Updates

Published:

Introduction

In this article, I will explain which updates were done to the Selenium python example project I developed together with Elias Shourosh.

link to the project.

The technological stack used to implement the solution is:

Programing language: Python

Testing Framework: pytest

Reporting Framework: Allure

Replacing Selenium Grid Action With Bundled Chrome Browser + Driver

Previously, our workflow used a built-in action to spin a remote grid provider called selenoid, but when the browser was updated, the desired capabilities had to be changed which is undesirable. Moreover, we found that ubuntu-latest machines are already bundled with Google Chrome browser and a matching ChromeDriver.

We removed the “remote” browser option from confetest.py and are triggering a chrome headless option:

elif browser == "chrome_headless":
    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument("--headless")
    chrome_options.add_argument("--disable-dev-shm-usage")
    chrome_options.add_argument("--no-sandbox")
    driver = webdriver.Chrome(ChromeDriverManager().install(), options=chrome_options)

We also deleted the usage of the Selenoid action.

Using Dependabot automatically updated project dependencies

Keeping track of project dependencies manually is time-consuming, so automated bots were developed to simplify this process, Dependabot is my favorite. We created a dependabot.yml file and accepted all incoming PRs for GitHub actions and for our python dependencies.

Fixed a Bug In Reading Excel Files Duo To Dependency Update

We are using xlrd to store data in our automation tests. The Excel we used was saved in xlsx format, once xlrd was updated the new version only permits xls format so this fix solved the problem.

Used a Built-in action For installing python dependencies

Our workflow was previously using a shell command to install the python dependencies, this commit is using a built-in GitHub action.

Added Chrome Version to Allure Environment

Each workflow generates an allure report which is stored under GitHub pages on this repository, this was explained in a previous article. When finding defects in the SUT, it’s important to mention the browser version, some defects will not reproduce in different versions. The following commit adds this important information.

the report now includes the browser version:

No alt text provided for this image

In conclusion

In this article, we reviewed key infrastructure updates made during the project maintenance. The updates were done in order for this project to maintain its status as a leading selenium python example project (currently with 15 GitHub stars and hundreds of views on a daily basis).

Happy testing!


Suggest Changes

Have a challenge? Let's Talk


Previous Post
Test Automation - How To Create an Independent Automation Infrastructure using GitHub Actions
Next Post
Test Automation - How To extend selenium functionality using Lombok extension methods