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
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.
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.
Next run the command pip3.9 install -r requirements.txt
to install the required packages in the venv.
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):
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.
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