Registry / testing / browserstack-local

browserstack-local

JSON →
library1.2.15pypypi✓ verified 85d ago

The `browserstack-local` Python library provides bindings for the BrowserStack Local testing feature. It allows users to test websites hosted on local development environments, staging environments, or behind firewalls/proxies, by establishing a secure tunnel between the user's machine and the BrowserStack cloud. The library is currently at version 1.2.14 and maintains an active development status with a positive release cadence, often releasing new versions within three months.

pip install browserstack-local
INSTALL
IMPORT
SIG · BROWSERSTACK-LOCAL
B
browserstack-local
testingpythonv1.2.15
Install
1.7s avg
Import
184ms
Disk
18MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.14 · 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
3/4 runs
✓ 1.73s
py 3.11
3/4 runs
✓ 1.78s
py 3.12
3/4 runs
✓ 1.6s
py 3.13
3/4 runs
✓ 1.63s
py 3.9
3/4 runs
✓ 2s
18MB installed
● package 18MB
Code
Verified usage

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

Local
from browserstack.local import Local

This example demonstrates how to initialize, start, check the status of, and stop a BrowserStack Local tunnel. It uses an environment variable for the BrowserStack Access Key, which is the recommended practice for security. The `verbose` option is added for detailed logging.

import os from browserstack.local import Local bs_local = Local() # Replace <browserstack-accesskey> with your key or set as environment variable BROWSERSTACK_ACCESS_KEY access_key = os.environ.get('BROWSERSTACK_ACCESS_KEY', 'YOUR_BROWSERSTACK_ACCESS_KEY') bs_local_args = { "key": access_key, "verbose": "true" # Optional: enable verbose logging } try: # Start the Local instance bs_local.start(**bs_local_args) print("BrowserStack Local started.") # Check if BrowserStack Local instance is running if bs_local.isRunning(): print("BrowserStack Local is running.") # Your test logic here that uses the local tunnel else: print("BrowserStack Local is NOT running.") finally: # Stop the Local instance if bs_local.isRunning(): bs_local.stop() print("BrowserStack Local stopped.")
Debug
Known issues
gotchaBinary download issues or corruption: The `browserstack-local` library automatically downloads and manages the underlying BrowserStack Local binary. Network issues, restrictive firewalls, or insufficient file permissions can prevent successful download or corrupt the binary, leading to connection failures.
fix
Ensure stable internet connectivity and appropriate firewall/proxy settings. From v1.2.1, the library attempts to re-download corrupt binaries. Manually delete the binary (often in a temporary directory) to force a fresh download if issues persist.
affects: All versions
gotchaMultiple Local instances: Running multiple instances of BrowserStack Local without unique `localIdentifier`s will cause older connections to drop, leading to unstable tests or connection failures.
fix
Ensure each concurrent local connection uses a unique `localIdentifier` argument. Alternatively, use the `force: true` option to automatically terminate other running instances when starting a new one.
affects: All versions
gotchaIncorrect `binary_path` option: While `v1.2.2` addressed issues with the `binary_path` option, incorrectly configuring it or pointing to an inaccessible path can still prevent the local tunnel from starting.
fix
Ensure `binary_path` points to a valid and accessible BrowserStack Local binary. If you encounter issues, consider removing this option and letting the library manage the binary automatically.
affects: <1.2.2 (buggy), all versions (user error)
gotchaEnvironment variable for access key: Prior to `v1.1.0`, there were known issues with environment variable handling for the `BROWSERSTACK_ACCESS_KEY`, which could lead to authentication failures.
fix
Upgrade to `browserstack-local` version `1.1.0` or newer to ensure reliable environment variable processing for your access key.
affects: <1.1.0
Errors
Common errors & fixes
Another BrowserStack Local Instance Running
An existing BrowserStack Local process is already active on the machine, potentially from a previous test run, a different user, or an older version of the application. Using the same `localIdentifier` for multiple connections can also trigger this.
fix
Terminate all existing BrowserStack Local processes. If starting multiple local connections, ensure each uses a unique `localIdentifier` in `bs_local_args`. You can also use the `force: true` option in `bs_local_args` to automatically kill other instances.
BrowserStackLocal binary is corrupt
The downloaded BrowserStack Local binary is damaged or could not be downloaded completely due to network instability, firewall restrictions, or insufficient file permissions.
fix
Ensure stable internet connectivity and appropriate firewall/proxy settings. The library (from v1.2.1) attempts to re-download corrupt binaries automatically. If the issue persists, manually delete the binary (typically located in a temporary directory specific to the library) to force a fresh download.
Local connection not established (or tests failing with 'Host unreachable')
The secure tunnel between your local machine and the BrowserStack cloud could not be established. This often points to network instability, incorrect proxy settings, or firewall blocks preventing outgoing connections from the BrowserStack Local binary.
fix
Verify your internet connection. If you are behind a corporate proxy, ensure that `proxyHost`, `proxyPort`, `proxyUser`, and `proxyPass` are correctly configured in your `bs_local_args`. Check your system's firewall rules to ensure they allow outgoing connections from the BrowserStack Local binary.
Upgrade
Version history
1.2.15latest on PyPI · released Jun 8, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
18
OpenAI (training)
1
Resources