This project is a Selenium-based Python automation framework designed for cross-browser and cross-device testing using the LambdaTest platform.
It enables the execution of test scripts across a wide range of real and virtual devices.The framework follows Page Object Model (POM) design pattern, promoting reusability, maintainability.
- Excel-Driven Configurations
- The framework extracts test environment details such as browser, platform, device name and test URL from a structured Excel file without modifying code.
- Cross-Browser & Cross-Device Execution
- Allows Cross-browser and cross-device testing on LambdaTest and Supports both real and virtual devices
- Automated Reporting
- Automatically generates an Excel report with Device/browser/OS info,Test execution status and LambdaTest video session link
- This diagram illustrates the complete workflow of the framework.
- The project follows a modular folder structure with dedicated directories for configurations, test scripts, reports, and utilities, ensuring better maintainability and scalability.
- Sign Up: Go to LambdaTest Sign Up and create a free account.
- 💡 Note: Plan Selection: For real device testing, ensure your plan includes: Web Automation Testing → Web & Mobile Browser on Real Device
- Get Your Credentials: Once logged in, open the side menu in the Dashboard.
- Copy your Username and Access Key from the Credentials section to connect your tests to LambdaTest.
- Clone the repository
git clone https://github.com/infuse-consulting/LambdaTest-Compatibility-testing-framework.git cd LambdaTest-Compatibility-testing-framework
- Install dependencies
pip install -r requirements.txt
- Set up LambdaTest credentials in project
Create a .env
file in the root directory:
LT_USERNAME= your_lambdatest_username LT_ACCESS_KEY= your_lambdatest_access_key
python -m venv .venv .venv\Scripts\Activate.ps1
python -m venv .venv .venv\Scripts\activate.bat
python3 -m venv .venv source .venv/bin/activate
The file ./src/data/test_data.xlsx
contains all configuration data for your test environment:
Devices Sheet: Defines cross-browser/device parameters: browser, browserVersion, platform, platformVersion, deviceName, etc.
💡 Note: Use the provided template.You may add new devices, but ensure column names remain unchanged.
💡 Note: To check which devices support which platform versions: use the LambdaTest Capabilities Generator.
Example:
Url Sheet: Stores the test URL for running tests.
Example:
Example of generated Test configuration JSON object from excel file ./src/data/test_data.xlsx
:
JSON Object:
{ "browser": "Chrome", "browserVersion": "138", "platformName": "android", "platformVersion": "14", "deviceName": "Galaxy S24 ", "isRealMobile": "False" }
The conftest.py file contains reusable pytest fixtures for test setup.
- dataLoad: Loads test data (username, access key, URL) from .env and Excel.
- driver: Creates and configures a Selenium WebDriver session on LambdaTest.
- setup: Returns pre-initialized
LoginPage
,Utils
to use in tests.
Example usage in a test:
def test_login(setup): login_page, assertion, url = setup login_page.navigate_to_page(url) login_page.login() assertion.assert_page_is_displayed(login_page.products_catalog_page, "Products Catalog Page")
Run a test using pytest:
pytest .\tests\test_login.py -v -s
💡 Note: Test files should be placed inside the tests/ directory Test function names must be prefixed with test_ for pytest to detect and execute them.
- Execute the test across all environments defined in the Excel file.
- Automatically generates a
compatibility_test_report
in reports/ folder in Excel format with:- Device, Browser,Platform details
- Pass/Fail status
- LambdaTest session video link
Example of ./reports/compatibility_test_report.xlsx
:
💡 Note: Every execution appends Test Results to compatibility_test_report