Registry / testing / browserstack-sdk

browserstack-sdk

JSON →
library1.46.0pypypi✓ verified 86d ago

This is a legacy Python SDK for integrating Selenium-webdriver tests with BrowserStack. It is officially deprecated and no longer actively maintained. BrowserStack now recommends using standard Selenium with BrowserStack capabilities directly. The last release of this SDK was 1.45.0 in April 2022.

pip install browserstack-sdk
INSTALL
IMPORT
SIG · BROWSERSTACK-SDK
B
browserstack-sdk
testingpythonv1.46.0
Install
10.2s avg
Import
194ms
Disk
124MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.46.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
1/2 runs
✓ 9.95s
py 3.11
1/2 runs
✓ 9.9s
py 3.12
1/2 runs
✓ 10.15s
py 3.13
1/2 runs
✓ 9.55s
py 3.9
1/2 runs
✓ 11.5s
124MB installed
● package 124MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Local
from browserstack.local import Local
This import is specific to the deprecated SDK for managing BrowserStack Local tunnels.

This quickstart demonstrates how the deprecated `browserstack-sdk` was typically used for setting up BrowserStack Local testing with Selenium. It is provided for historical context and to highlight functionality unique to the SDK. For new projects, it is highly recommended to follow the official BrowserStack documentation for setting up Selenium tests without this SDK.

import os from selenium import webdriver from selenium.webdriver.common.by import By from browserstack.local import Local # Specific to the DEPRECATED SDK # --- WARNING: This SDK is deprecated. Use standard Selenium setup for new projects. --- # Configuration using environment variables BROWSERSTACK_USERNAME = os.environ.get('BROWSERSTACK_USERNAME', 'YOUR_USERNAME') BROWSERSTACK_ACCESS_KEY = os.environ.get('BROWSERSTACK_ACCESS_KEY', 'YOUR_ACCESS_KEY') # Desired capabilities for the test desired_cap = { 'bstack:options': { 'userName': BROWSERSTACK_USERNAME, 'accessKey': BROWSERSTACK_ACCESS_KEY, 'buildName': 'BrowserStack Python SDK Example (Legacy)', 'sessionName': 'Local Test with Deprecated SDK', 'local': 'true' # Enable local testing }, 'browserName': 'Chrome', 'browserVersion': 'latest', 'os': 'Windows', 'osVersion': '10' } bs_local = None driver = None try: # Start BrowserStack Local using the deprecated SDK's Local class bs_local = Local() bs_local_args = { "key": BROWSERSTACK_ACCESS_KEY, "forcelocal": "true" } print("Starting BrowserStack Local tunnel...") bs_local.start(bs_local_args) print("BrowserStack Local tunnel started.") # Initialize Selenium WebDriver connected to BrowserStack hub driver = webdriver.Remote( command_executor='https://hub.browserstack.com/wd/hub', desired_capabilities=desired_cap ) # Perform a test that requires local access driver.get("http://bs-local.com:45454/") print(f"Page title: {driver.title}") # Example assertion (this specific page is part of BrowserStack Local setup) if "BrowserStack Local" in driver.title: print("Test Passed: Successfully accessed local URL through BrowserStack Local.") else: print("Test Failed: Could not access local URL.") finally: # Stop BrowserStack Local tunnel if bs_local: print("Stopping BrowserStack Local tunnel...") bs_local.stop() print("BrowserStack Local tunnel stopped.") # Quit the WebDriver session if driver: driver.quit() print("WebDriver session quit.") # To run this example: # 1. Set BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY environment variables. # 2. pip install browserstack-sdk selenium # 3. python your_script.py
Debug
Known issues
breakingThe `browserstack-sdk` library is officially deprecated and no longer actively maintained by BrowserStack. It is strongly recommended to use standard `selenium` with BrowserStack capabilities directly for all new development.
fix
Migrate your tests to directly use `selenium.webdriver.Remote` and configure BrowserStack capabilities (e.g., `bstack:options`) as described in the official BrowserStack documentation (https://www.browserstack.com/docs/automate/selenium/python/getting-started).
affects: All versions
gotchaUsing this deprecated SDK may lead to compatibility issues with newer versions of Python, Selenium, or BrowserStack infrastructure, as it receives no further updates. This could result in unexpected errors or security vulnerabilities.
fix
Refer to the official BrowserStack documentation for up-to-date best practices for Python and Selenium integration, which provide current and maintained solutions.
affects: All versions
gotchaThe methods for setting up local testing (BrowserStack Local) provided by `browserstack.local.Local` are specific to this deprecated SDK. The recommended approach for local testing now involves setting `bstack:options` in your capabilities and typically starting the local tunnel via the BrowserStack Local application or CLI, not through this SDK.
fix
Consult the BrowserStack documentation on local testing with Python and Selenium for the current setup instructions, which typically do not involve programmatic control from this specific SDK.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'browserstack'
Attempting to import modules from the deprecated `browserstack-sdk` without it being installed, or after migrating to the modern approach that doesn't use these imports.
fix
If you intend to use the legacy SDK (not recommended), run `pip install browserstack-sdk`. Otherwise, remove all imports related to `browserstack-sdk` (e.g., `from browserstack.local import Local`) and rewrite your test using standard `selenium` methods with direct capability configuration.
selenium.common.exceptions.WebDriverException: Message: Error forwarding the new session Error forwarding the new session Request: {}
This generic WebDriver error often indicates issues with BrowserStack credentials, outdated capabilities, or problems connecting to the BrowserStack hub. When using the deprecated SDK, it might not correctly handle newer authentication or connection methods.
fix
Verify `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` environment variables (or hardcoded values) are correct. Ensure your specified browser and OS capabilities are valid and supported by BrowserStack. If using local testing, verify the BrowserStack Local service is running and configured correctly according to the *latest* BrowserStack documentation, not the SDK's old methods.
AttributeError: 'Remote' object has no attribute 'get_bstack_local'
This SDK might have provided helper methods or custom WebDriver wrappers that are no longer available or relevant when using standard `selenium.webdriver.Remote`. Such an error indicates a call to a method specific to the SDK that does not exist on the standard Selenium WebDriver object.
fix
If you are migrating away from the deprecated SDK, replace such SDK-specific calls with standard Selenium WebDriver methods or direct BrowserStack capability settings. If you *must* use the SDK, ensure you are calling methods correctly as per its original documentation and that you are using the correct WebDriver instance that the SDK might have wrapped.
Upgrade
Version history
1.46.0latest on PyPI · released Apr 30, 2026
Audit
Dependencies
seleniumrequiredCore dependency for WebDriver interactions, requires >=4.0.0
requestsrequiredHTTP client for API interactions
websocket-clientrequiredUsed for WebSocket communication, requires >=1.0.0
Agent activity
32 hits · last 30 days
node
30
OpenAI (training)
1
Resources
browserstack-sdk — pip install browserstack-sdk · libregistry