Author and run E2E tests on BrowserStack Automate - cloud grid covering 3000+ real device + browser combinations. Covers BROWSERSTACK_USERNAME + ACCESS_KEY auth, hub URL https://hub-cloud.browserstack.com/wd/hub, W3C capabilities + bstack:options (projectName, buildName, sessionName), BrowserStackLocal for testing against localhost / internal environments, parallel session limits, and CI integration. Use for cross-browser regression on real devices + browsers - distinct from running a single test framework locally, and from a matrix runner limited to the browser engines bundled on the local machine.
75
94%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Low
Low-risk findings worth noting
BrowserStack Automate is a hosted Selenium / Playwright / Cypress grid that exposes 3000+ real device + browser combinations (iOS, Android, Windows, macOS) via a standard WebDriver-compatible endpoint. Per browserstack.com/docs/automate/selenium.
This skill wraps BrowserStack for Selenium-style invocation; Playwright + Cypress integrations follow a different (but similar) pattern documented separately by BrowserStack.
Composes with browser-matrix-strategy-reference (in the
qa-compatibility plugin) for matrix planning.
For bundled-engine matrix (Chromium / Firefox / WebKit on the
runner machine), use browser-matrix-runner.
For orchestration across local + cloud grids, use a dedicated
grid-orchestration layer.
BROWSERSTACK_USERNAME + BROWSERSTACK_ACCESS_KEY from account settings.https://hub-cloud.browserstack.com/wd/hub.bstack:options block (set projectName, buildName, sessionName), then run one suite end to end - see Worked example.driver.quit(), so the dashboard metrics stay accurate.bstack:options table, and REST session retrieval, see references/ci-and-scaling.md.Per BrowserStack Automate docs, set env vars:
export BROWSERSTACK_USERNAME="your-username"
export BROWSERSTACK_ACCESS_KEY="<access-key-from-account-settings>"https://hub-cloud.browserstack.com/wd/hubConnect any WebDriver client (Selenium, WebdriverIO, Nightwatch)
to this URL with the standard RemoteWebDriver-style
construction.
Standard W3C fields - browserName, browserVersion, platformName
(or BrowserStack's non-standard os + osVersion) - plus a
bstack:options block for BrowserStack-specific settings:
{
"browserName": "Chrome",
"browserVersion": "latest",
"os": "Windows",
"osVersion": "11",
"bstack:options": {
"projectName": "My App",
"buildName": "PR-1234",
"sessionName": "Login flow on Chrome Windows",
"local": "false"
}
}The exhaustive bstack:options table (debug, networkLogs,
consoleLogs, video, seleniumVersion, ...) is in
references/ci-and-scaling.md.
Run one Selenium suite on the grid end to end - build capabilities, create the remote driver, drive the test, report status, quit:
import os
from selenium import webdriver
caps = {
"browserName": "Safari",
"browserVersion": "17",
"os": "OS X",
"osVersion": "Sonoma",
"bstack:options": {
"projectName": "my-app",
"buildName": os.environ.get("BUILD_TAG", "local-run"),
"sessionName": "Checkout flow on Safari macOS",
"local": "false",
},
}
driver = webdriver.Remote(
command_executor=(
f"https://{os.environ['BROWSERSTACK_USERNAME']}:"
f"{os.environ['BROWSERSTACK_ACCESS_KEY']}"
f"@hub-cloud.browserstack.com/wd/hub"
),
options=webdriver.SafariOptions(), # base options
)
# inject capabilities
for k, v in caps.items():
driver.capabilities[k] = v
driver.get("https://example.com")
# ... test ...
# mark the session pass / fail so the dashboard metrics are accurate
driver.execute_script(
'browserstack_executor: {"action": "setSessionStatus", '
'"arguments": {"status":"passed","reason":"Login redirected as expected"}}'
)
driver.quit()(Modern WebDriver clients prefer constructing through options + a
capabilities dict; consult the chosen client's docs.) Use
"status":"failed","reason":"..." on failure - the session-status
call drives the BrowserStack dashboard's pass / fail metrics +
filtering.
To run tests against localhost / internal environments, start the
tunnel and set bstack:options.local = "true" on the session:
# Download the BrowserStackLocal binary from browserstack.com
./BrowserStackLocal --key "$BROWSERSTACK_ACCESS_KEY" --daemon start
# Sessions with bstack:options.local = "true" now tunnel
./BrowserStackLocal --key "$BROWSERSTACK_ACCESS_KEY" --daemon stopOr via Docker:
docker run --name bstacklocal -d --rm \
browserstack/local --key "$BROWSERSTACK_ACCESS_KEY"| Anti-pattern | Why it fails | Fix |
|---|---|---|
| Credentials in code | Token leak | Env vars / secret store |
| All tests on every browser combo | Slow + expensive (plan-limited) | Tier the matrix - see browser-matrix-strategy-reference |
| Missing buildName | Sessions un-grouped in dashboard | Always set buildName to CI run / PR identifier |
| No session-status update | Dashboard pass/fail rate inaccurate | Always set session status before quit |
| BrowserStackLocal not stopped | Stale tunnels accumulate | Always daemon stop after test |
| Parallel exceeds plan limit | Sessions queue + timeout | Match MAX_PARALLEL to plan |
| Treating real-device dashboard as live | BrowserStack sessions can have minute-level setup latency | Build wait + retry around setup |
browser-matrix-strategy-reference.saucelabs-automate,
lambdatest-automate,
selenium-grid-4-runner.