This code is a Python script that demonstrates how to perform parallel testing using Pytest and Selenium. It includes three test cases that run in parallel, each using a different browser and platform configuration provided by LambdaTest. The test cases perform actions such as opening a webpage, entering login credentials, and verifying the page title.
- Pytest: The code requires the Pytest framework to be installed. You can install it using the following command:
pip install pytest
- Selenium: The code also requires the Selenium library to be installed. You can install it using the following command:
pip install selenium
- Chrome WebDriver: The code uses Chrome WebDriver for testing with Chrome browsers. Make sure you have Chrome WebDriver installed and available in your system's PATH. You can install it using the following command:
pip install webdriver_manager
-
Make sure you have installed the necessary dependencies as mentioned above.
-
Update the code with your LambdaTest username, access token, and password. Replace the placeholders in the following lines:
username = "your_username_here" # Replace with your LambdaTest username
accessToken = "your_access_token_here" # Replace with your LambdaTest access token
passs = "your_password_here" # Replace with your LambdaTest account password
- Run the script using the following command:
pytest script.py
-
The code uses the LambdaTest Selenium grid to execute the tests in parallel on remote browsers. Make sure you have a valid LambdaTest account and provide the correct username, access token, and password.
-
Each test case is marked with the
@pytest.mark.parallel
decorator, which enables parallel testing for those specific tests. -
The code includes sample capabilities for Chrome and Microsoft Edge browsers on different platforms. You can modify these capabilities to match your desired browser and platform configurations.
-
It's important to call
driver.quit()
at the end of each test case to close the browser and release system resources.
This code is released under the MIT License. Feel free to modify and use it according to your needs.
For any questions or suggestions, please feel free to contact [author_name] at [author_email].