Skip to content

Files

Latest commit

 

History

History
81 lines (50 loc) · 3.89 KB

README.md

File metadata and controls

81 lines (50 loc) · 3.89 KB

Tutorial: Running Selenium 3.xxx tests with Python 3.9 (on Cloud Grid)

selenium_python_banner

Pre-requisites for test execution

This repo is a modified version of the official Selenium Python Sample. The changes will help in running Selenium 3 tests with Python 3.9 (on LambdaTest cloud grid). The desired capabilities (for Selenium 3) can be generated using LambdaTest Capabilities Generator.

Follow the steps along to trigger the test execution:

Step 1

Create a virtual environment by triggering the virtualenv venv command on the terminal

virtualenv venv
VirtualEnvironment

Step 2

Navigate the newly created virtual environment by triggering the source venv/bin/activate command on the terminal

source venv/bin/activate

Step 3

Procure the LambdaTest User Name and Access Key by navigating to LambdaTest Account Page. You might need to create an an account on LambdaTest since it is used for running tests on the cloud Grid.

LambdaTestAccount

Set LambdaTest Username and Access Key in environment variables.

  • For Linux/macOS:
export LT_USERNAME="LT_USERNAME" 
export LT_ACCESS_KEY="LT_ACCESS_KEY"
  • For Windows:
set LT_USERNAME="LT_USERNAME" 
set LT_ACCESS_KEY="LT_ACCESS_KEY"

Step 4

The pre-requisites for this tutorial are: Python 3.9, urllib3 1.26.5 & Selenium 3.141.0. Run the command python3.9 --version and pip3.9 --version to check if Python 3.9 & pip (for Python 3.9) are installed on the machine.

python3 9_installation

Next run the command pip3.9 install -r requirements.txt to install the required packages in the venv.

python3 9_requirements

Steps for test execution

With this, all the dependencies and environment variables are set. Trigger the command python3.9 lambdatest.py to trigger Selenium 3 tests (with Python 3.9) on the LambdaTest dashboard.

Shown below is the terminal screenshot of the test execution (success & intended failure scenario):

python3 9_selenium3 14_success

python3 9_selenium3 14_failure

As seen below, the test execution was successful and the status is "Completed". You can find the status of test execution in the LambdaTest Automation Dashboard.

lambdatest_dashboard_screenshot

Have feedback or need assistance?

Feel free to fork the repo and contribute to make it better! Email to himanshu[dot]sheth[at]gmail[dot]com for any queries or ping me on the following social media sites:

LinkedIn: @hjsblogger
Twitter: @hjsblogger