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:
- 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 from selenium.webdriver.support.ui import WebDriverWait class OnFirefox(unittest.TestCase): def setUp(self): self.driver = webdriver.Remote( command_executor='http://localhost:4444/wd/hub',desired_capabilities...