Selenium With Python
Run Python tests on the TestMu AI cloud grid. This guide covers setup, running a sample test, configuring capabilities, and testing locally hosted pages.
All the code used in this guide is available in the sample repository.
Prerequisites
Complete these steps before running your first Python Selenium test.
- Install the latest Python build from the official website.
- Verify that pip is installed in your system. Install pip from pip documentation.
- Download the latest Selenium Client and its WebDriver bindings from the official website.
Step 1: Clone the Sample Project
Clone the repository and install dependencies.
git clone https://github.com/LambdaTest/python-selenium-sample
cd python-selenium-sample
Install the Selenium driver using pip:
pip install selenium
export PYTHONWARNINGS="ignore:Unverified HTTPS request" //Disable ssl warning
Step 2: Set Your Credentials
Configure your credentials to connect to the TestMu AI Selenium Grid.
Set TestMu AI Username and Access Key in environment variables.
- macOS / Linux
- Windows
export LT_USERNAME="undefined"
export LT_ACCESS_KEY="undefined"
set LT_USERNAME="undefined"
set LT_ACCESS_KEY="undefined"
Step 3: Configure Your Test Capabilities
Define browser, version, and OS settings for your test run.
In the Python script, update your test capabilities. This code passes browser, browser version, and operating system information, along with TestMu AI Selenium grid capabilities via the capabilities object.
capabilities = {
"build": "your build name",
"name": "your test name",
"platformName": "Windows 10",
"browserName": "Chrome",
"browserVersion": "latest",
}
Use the TestMu AI Capabilities Generator to auto-generate the capabilities class for your test requirements.
Step 4: Run the Test
Execute the Python Selenium test from the command line.
python google-search-lambdatest.py
Step 5: View Your Results
Check the test output on the console and the TestMu AI dashboard.
Visit the TestMu AI Automation Dashboard to view your test results. The dashboard provides:
- Text logs for each test step
- Screenshots captured during execution
- Video recordings of the full test session
Run Python Selenium Tests Using Agent Skills
Use AI coding assistants to generate and run Python Selenium tests with the TestMu AI Agent Skill.
The selenium-skill is part of TestMu AI Agent Skills - structured packages that teach AI coding assistants how to write production-grade test automation.
Install the skill:
git clone https://github.com/LambdaTest/agent-skills.git
cp -r agent-skills/selenium-skill .claude/skills/
# For Cursor / Copilot
cp -r agent-skills/selenium-skill .cursor/skills/
Install all available framework skills at once by cloning the repository directly into your tool's skills directory (e.g., .claude/skills/, .cursor/skills/).
