Book Image

Learning Selenium Testing Tools with Python

By : UNMESH GUNDECHA
Book Image

Learning Selenium Testing Tools with Python

By: UNMESH GUNDECHA

Overview of this book

Table of Contents (17 chapters)
Learning Selenium Testing Tools with Python
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Running tests in Grid


Running tests in Grid and with different combinations of browsers and operating systems will need a few tweaks to the tests that we created earlier. We specified hardcoded browser and platform names in the desired capabilities. If we hardcode the values, then we will end up having a separate script for each combination. To avoid this and use a single test that will work on all the combinations, we need to parameterize the browser and platform values passed to the desired capabilities class as given in the following steps:

  1. We will pass the browser and platform to the tests from the command line. For example, if we want to run test on the Windows and Chrome combination we will run the script through the command line in the following way:

    python grid_test.py WINDOWS chrome
    
  2. If we want to run tests on Safari on Mac, we can use following command:

    python grid_test.py MAC safari
    
  3. To implement this, we need to add two global attributes, PLATFORM and BROWSER, to the test class...