⚙️ Setup & Account Configuration
Setup & Account Configuration: Think of BrowserStack setup as a "satellite ground-station connection": you are not launching the satellite (the BrowserStack cloud) — you just nee
Think of BrowserStack setup as a "satellite ground-station connection": you are not launching the satellite (the BrowserStack cloud) — you just need to set up the ground station (Python SDK + credentials) and enter the correct frequency (BROWSERSTACK_USERNAME + BROWSERSTACK_ACCESS_KEY). You might say "I just add an import and change the URL — why is there a separate setup step?" Because when the BrowserStack SDK establishes a driver connection it manages authentication middleware, network tunnel, session metadata, and capability validation behind the scenes — changing only the URL triggers none of those and you get a local certificate validation error. In Java, writing `new RemoteWebDriver(new URL("https://hub.browserstack.com/wd/hub"), caps)` for RemoteWebDriver required you to build the capabilities object by hand; the Python SDK manages this through config.yml and credentials come from environment variables, never hardcoded in source. The critical QA point: `BROWSERSTACK_ACCESS_KEY` must never be written in source code — add it as an environment secret in CI, and you can run the same code with different accounts in different environments (staging vs production) with zero key-leak risk.
Step 1 — Account & API Key
Environment Variable
Step 2 — Python SDK Installation
Create a virtual environment. A "venv" folder appears in this directory.
Activate the virtual environment. You should see (venv) in the terminal.
Install BrowserStack SDK, Selenium, and pytest. The SDK manages all connections automatically.
Verify installation. A version number should appear.
Step 3 — browserstack.yml Configuration
BrowserStack SDK reads a browserstack.yml file at the project root. This file is similar to testng.xml or pytest.ini in Java — it defines which browsers to test on and how many parallel tests to run.
# browserstack.yml — place at project root
Micro Lab: Code practice
Replace the TODO line with the critical line from the expected solution. This is not a real runtime; the goal is to reinforce writing the correct structure in a controlled way.
Step by Step: Code practice
Installation steps
- python -m venv venv — Create a virtual environment. A "venv" folder appears in this directory.
- venv\Scripts\activate — Activate the virtual environment. You should see (venv) in the terminal.
- pip install browserstack-sdk selenium pytest — Install BrowserStack SDK, Selenium, and pytest. The SDK manages all connections automatically.
- browserstack-sdk --version — Verify installation. A version number should appear.