CAPABILITY GENERATOR

LambdaTest DocumentationAutomation Testing ● Quick Guide To Run Python Tests on LambdaTest Selenium Grid

Quick Guide To Run Python Tests on LambdaTest Selenium Grid


LambdaTest Selenium Automation Grid is a cloud based scalable Selenium testing platform which enables you to run your automation scripts on 2000+ different browsers and operating systems. You can leverage LambdaTest Selenium grid to not only decrease the build time of Python automation scripts, but also increase your test coverage and check for more range of browsers for cross browser compatibility. This post will help you in getting started with configuring and running your Java based automation test scripts on LambdaTest Selenium cloud platform.

Prerequisites


  • Make sure that you have the latest Python build installed. You can download the latest Python build from https://www.python.org/downloads/.
  • You would need Python package manager, pip, as well. Usually latest python installers come prepacked with pip. However, if you don’t have pip, you can install it using the below command:

Installing Selenium Dependencies For Python


Make sure that you have installed Selenium dependencies before executing your tests. You can use pip to install Selenium using following command:

Sample Python and Selenium Test To Get You started


Now we are all set to execute the first Python test on LambdaTest Selenium Grid. Checkout the sample code below. This is a simple python code that uses LambdaTest Selenium grid to open up Google. You can also download it from our GitHub repo here.

Sample Python and Selenium Automation Script


You can execute the test from your terminal through this command.

The first thing to note here, is the use of remote WebDriver. Also checkout how the test passed on the enthronement configuration via desired_cap class.

To use your choice of environment for the test you can leverage our Capability Generator tool.

LambdaTest Capability Generator Tool

Tear Down: The tear down method helps LambdaTest platform understand when the execution of a test is finished. It’s important to tear down each test or else it will give timeout errors.