You can start a new test either from the Quick Start page or the Load Tests page on the Load testing dashboard.
On the dashboard, click Create Load Test.
Enter a Test Name for your load test, select Browser Only and click Upload scripts.
Upload scripts
In this step, upload your Selenium Python automation project as a ZIP file. Select your framework (for example, Selenium - Python) from the dropdown, then drag and drop your ZIP file (up to 250MB) or click to select it.
After you upload your ZIP file, the dashboard automatically validates your project. If validation is successful, you will see a confirmation message and a summary of the detected configuration and dependencies.
In the Specify run target field, enter the path to your Python file or module (for example, test_login.py). Then, select your requirements.txt file from the Select dependencies dropdown to specify which dependencies to install for your tests.
Ensure that your requirements.txt and any test runner configuration files are placed at the root level of your project.
Once you have verified the configuration, click Configure Load to move to the next step.
You can configure the following load parameters to customize your load test:
Save your BrowserStack credentials as environment variables. It simplifies running your Selenium Python load test suite from your local or CI environment.
Run the following command from the root directory of your Selenium Python test project to generate the browserstack-load.yml file, which contains the configuration required to define and run your load test.
Refer to the given table to use the framework - language combination argument depending on your preference:
Framework
Argument
Selenium - Python
--framework selenium --language python
Selenium - Pytest
--framework pytest --language python
Configure your Load Test
Open the generated browserstack-load.yml file and update it with the relevant Selenium Python test details. Use it to define your virtual users, duration, load profile, and regions.
Specify the test type
testType defines the type of load test that you want to execute. Currently, Playwright, Selenium, WebdriverIO and Nightwatch are supported. Set this to Selenium for a load test using Selenium test suite.
Specify the language
Set the language to python.
Currently, only Selenium with Python, and Pytest is supported.
For a Python (vanilla) project, you need to specify only the language parameter.
For a Pytest project, you must also specify the framework parameter with value pytest.
If you omit the framework parameter, the platform treats the project as a Python (vanilla) project.
Specify the test framework
Set the framework to pytest, if that is your preferred framework.
Specify the paths to your Python configuration file
The files block specifies the key files required to install dependencies and define which tests should be executed.
Under dependencies, ist the paths to required files for installing dependencies. For Python projects, include the path to your requirements.txt file.
Against runTarget, specify the path to python files (.py) or module (directory) that you want to run. Note: This attribute is only relevant for Python (vanilla) projects. This doesn’t work for Pytest projects.
Ensure all referenced files are relative to the project root.
Set reporting structure
Use projectName to group related tests under the same project on the dashboard. Use testName to group multiple runs of the same test.
Both projectName and testName must remain consistent across different runs of the same test.
You can use the following characters in projectName and testName:
Letters (A–Z, a–z)
Digits (0–9)
Periods (.), colons (:), hyphens (-), square brackets ([]), forward slashes (/), at signs (@), ampersands (&), single quotes ('), and underscores (_)
All other characters are ignored.
You can configure the following load parameters to customize your load test:
```yml
# =============================
# Set Credentials and Identity
# =============================
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
projectName: Default Project # Tests under the same projectName will be grouped together.
testName: Default Test # Test runs with the same testName will be grouped together.
# =========================================
# Set Configuration for Browser Load Tests (Required)
# =========================================
testType: Selenium
language: python # Programming language used in your project
files:
dependencies:
- ./requirements.txt
runTarget: test.py
# ======================
# Set Load Configuration
# ======================
# Add Mandatory values for a test run (vus, duration, regions)
vus: 3 # Virtual user count
duration: 4m # Example: '2m', '3m40s'
regions:
# Percent should total 100 across all loadzones
- loadzone: us-east-1
percent: 50
- loadzone: us-west-1
percent: 50
# Refer to the Load Testing documentation to add advanced features to your test: https://www.browserstack.com/docs/load-testing
```
Before running a full-scale load test, do a sanity check with a small set of virtual users to validate your Selenium Python configuration and test stability.