Selenium browser load test
Problem: You want to measure end-user experience — including JavaScript execution and page rendering — under concurrent load, using real browser instances rather than HTTP simulation.
Test type: Frontend browser performance test.
Prerequisites
Section titled “Prerequisites”- A MaxoPerf account and a workspace.
- Python 3.8+ and
seleniuminstalled locally (pip install selenium) to validate your script before uploading. - The URL of the page you want to test (staging or a dedicated load-test environment — never production without consent).
- Any credentials your flow needs, stored as a project secret.
Step by step in MaxoPerf
Section titled “Step by step in MaxoPerf”1. Write the Selenium script
Section titled “1. Write the Selenium script”Create test_homepage.py locally. This script logs in and verifies the dashboard loads:
from selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as ECimport os
def test_homepage(driver): base_url = os.environ.get("BASE_URL", "https://app.example.com")
# Load the login page driver.get(f"{base_url}/login")
WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.ID, "email")) )
# Fill credentials — injected via MaxoPerf secrets as env vars driver.find_element(By.ID, "email").send_keys( os.environ.get("TEST_EMAIL", "testuser@example.com") ) driver.find_element(By.ID, "password").send_keys( os.environ.get("TEST_PASSWORD", "changeme") ) driver.find_element(By.CSS_SELECTOR, "button[type='submit']").click()
# Assert the dashboard loaded WebDriverWait(driver, 15).until( EC.url_contains("/dashboard") )
# Verify at least one key element is visible WebDriverWait(driver, 10).until( EC.visibility_of_element_located((By.CSS_SELECTOR, "[data-testid='dashboard-header']")) )The function name must be test_<anything> — Taurus’s Selenium executor discovers test functions by this prefix.
2. Write the Taurus YAML
Section titled “2. Write the Taurus YAML”Create selenium-homepage.yml:
execution: - executor: selenium concurrency: 5 # 5 parallel Chrome instances — scale up slowly ramp-up: 30s # reach full concurrency over 30 seconds hold-for: 3m # sustain for 3 minutes scenario: homepage-login
scenarios: homepage-login: script: test_homepage.py # must match the filename uploaded as a Test asset browser: chrome # chrome (default) or firefox
settings: env: BASE_URL: https://staging.example.comCredentials (TEST_EMAIL, TEST_PASSWORD) are not in the YAML — inject them as project secrets so they never appear in version control.
3. Upload files to MaxoPerf
Section titled “3. Upload files to MaxoPerf”- Open your test in the MaxoPerf console and go to the Files tab.
- Upload
selenium-homepage.ymland mark it as the Entrypoint. - Upload
test_homepage.pyand leave it as a Test asset. MaxoPerf matches this filename to thescript:key in your YAML. - Click Save. MaxoPerf validates the YAML: it checks
executor: selenium, confirmstest_homepage.pyis present as a test asset, and shows a green validation badge.
4. Add project secrets
Section titled “4. Add project secrets”- Go to Project → Secrets.
- Add
TEST_EMAILandTEST_PASSWORDwith their staging values. - Return to the test and confirm the secrets are selected in the Secrets dropdown.
5. Run the test
Section titled “5. Run the test”- Click Run on the test detail page.
- MaxoPerf bundles
selenium-homepage.yml,test_homepage.py, and the injected secrets, then dispatches the bundle to a runner. - The runner starts 5 Chrome instances (
concurrency: 5), ramping over 30 seconds, and drives each browser through thetest_homepagefunction in a loop for 3 minutes.
Verify
Section titled “Verify”Once the run completes, check the following in the Run detail view:
- Error rate — should be near 0%. A WebDriver
TimeoutExceptionor assertion failure counts as an error. Check the Errors tab for stack traces if you see failures. - Iteration time — the time to complete one full browser flow. For a login-and-dashboard load, expect 3–10 seconds depending on app performance.
- Throughput — iterations per second. With 5 VUs and a ~5 s iteration, expect ~1 it/s.
- Resource utilisation — check the runner CPU/memory panel. Browser tests are CPU-bound; if utilisation is above 90%, reduce concurrency before scaling up.
Variations
Section titled “Variations”Use Firefox instead of Chrome
Section titled “Use Firefox instead of Chrome”scenarios: homepage-login: script: test_homepage.py browser: firefoxTest a multi-step checkout flow
Section titled “Test a multi-step checkout flow”Extend the test function to navigate through checkout steps:
def test_checkout(driver): # ... login steps ...
driver.find_element(By.LINK_TEXT, "Products").click() WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.CSS_SELECTOR, ".product-card")) )
driver.find_element(By.CSS_SELECTOR, ".product-card:first-child button").click() driver.find_element(By.LINK_TEXT, "Checkout").click()
WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.CSS_SELECTOR, ".order-summary")) )Update scenarios.homepage-login.script to test_checkout.py and re-upload.
Use a Selenium IDE recording instead of a Python script
Section titled “Use a Selenium IDE recording instead of a Python script”Record your flow in Selenium IDE, export as a .side file, and upload it directly as the entrypoint — MaxoPerf infers executor: selenium from the .side extension without needing a YAML wrapper:
my-recording.side → Entrypoint → engine: seleniumOr wrap it in YAML for explicit concurrency control:
execution: - executor: selenium concurrency: 3 hold-for: 5m scenario: recorded-flow
scenarios: recorded-flow: script: my-recording.sideAdd failure criteria
Section titled “Add failure criteria”Automatically fail the run if the error rate exceeds 2% or iteration time exceeds 12 s:
reporting: - module: passfail criteria: - error-rate > 2% for 30s: fail - avg-rt > 12s for 1m: failSee Failure criteria pass/fail gates for the full passfail reference.
Where to go next
Section titled “Where to go next”- Selenium browser tests — full reference for the Selenium executor options.
- Frontend browser performance test — when browser-level testing is and isn’t appropriate.
- Taurus executor catalog — the
seleniumandwdioentries. - Taurus fundamentals — Taurus YAML structure and upload workflow.
- Manage test secrets — keeping credentials out of your YAML and script files.