Creating and executing the Selenium script in parallel with Python

In this recipe, we will create and execute tests in parallel with Python bindings using the subprocess module. We will use the Hub and nodes configured in earlier recipes to run these tests.

How to do it...

We will create two test scripts to test the application with Firefox and Internet Explorer using the following steps. You can also create a single test and parameterize it similar to what we did for TestNG:

  1. For the first Python test, which will test the application functionality using the Firefox browser, name this test as test_on_firefox.py and copy the following code:
    import unittest from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities ...

Get Selenium Testing Tools Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.