Omar Ortega

Husband, Father of 3 kids, Developer

Parallel Execution with Selenium Grid and Docker

In my opinion Parallel Execution is one of the crucial features we could have in an Automation Framework, why?… because it enables the way we are going to execute our tests, and the velocity on getting results on the Test Suite.

Selenium Grid

Why using selenium grid?, well first of all it is because the team that is developing and maintaining it, is the same team developing the Selenium automation library. Another important point is that, we can use Docker to spin up the Selenium Grid and be ready to send commands, so lets see how we can do this.


Page Object Model in action with Pytest - Selenium

We always read or hear about implementing the Page Object Model design pattern in our frameworks, and its benefits. As an advocate for using POM on every Test Automation Project/Framework, I want to share why. The enormous benefits that POM provides, such as improving reusability and avoiding code duplication, are undeniable.

POM is based on creating Pages that model our system under test. One of the biggest challenges in developing end-to-end tests with Selenium is maintainability and flakiness. However, by implementdfajkjkajkdfjakjfakjfing good test design practices, we can significantly mitigate these issues.


Selecting a web browser from command line

When we are automating Web applications, it is important to have a good configuration process that helps us on selecting the web browser we want to use for testing.

I like the idea of selecting program options from the command line, like the ones we have for several tools we already use. When we execute our pytest tests and we want to have more information:

pytest -verbose

The -verbose option is passed to the pytest program as a command line option that is configuring pytest to provide a more verbose output, we can implement the same within our framework and have a way to select a web browser from our own list.


Creating Fixtures for Selenium Global configuration

Fixtures in pytest are functions that define a context for a test, they are super helpful in adding context for a test, in our case defining context for tests that are using the Selenium Webdriver. This is super powerful for designing complex tests. Those functions are accessible through arguments in the test functions.

Let’s see how we can implement those fixture functions in our framework. First we need to create a new file conftest.py, next we need to import the pytest library, and add the pytest decorator:


Creating a Selenium-Pytest Framework from scratch

In this first blog post we are going to learn on how to install the tools to start working with Pytest and Selenium. In this series of blogs I am going to go through on what is needed to create a POM (Page Object Model) framework from scratch, so you can create your own tests 🧐.

Installing all dependencies

We would need to first create a simple project, you can use whatever IDE you like, it can be VSCODE, PYCHARM (those instructions are out of the scope for this blog).