Skip to main content

browserstack-local-python

Build Status

Python bindings for BrowserStack Local.

Installation

pip install browserstack-local

Example

from browserstack.local import Local

#creates an instance of Local
bs_local = Local()

#replace <browserstack-accesskey> with your key. You can also set an environment variable - "BROWSERSTACK_ACCESS_KEY".
bs_local_args = { "key": "<browserstack-accesskey>" }

#starts the Local instance with the required arguments
bs_local.start(**bs_local_args)

#check if BrowserStack local instance is running
print(bs_local.isRunning())

#stop the Local instance
bs_local.stop()

Arguments

Apart from the key, all other BrowserStack Local modifiers are optional. For the full list of modifiers, refer BrowserStack Local modifiers. For examples, refer below -

Verbose Logging

To enable verbose logging -

bs_local_args = { "key": "<browserstack-accesskey>" , "v": "true"}

Folder Testing

To test local folder rather internal server, provide path to folder as value of this option -

bs_local_args = { "key": "<browserstack-accesskey>" , "f": "/my/awesome/folder"}

Force Start

To kill other running Browserstack Local instances -

bs_local_args = { "key": "<browserstack-accesskey>" , "force": "true"}

Only Automate

To disable local testing for Live and Screenshots, and enable only Automate -

bs_local_args = { "key": "<browserstack-accesskey>" , "onlyAutomate": "true"}

Force Local

To route all traffic via local(your) machine -

bs_local_args = { "key": "<browserstack-accesskey>" , "forcelocal": "true"}

Proxy

To use a proxy for local testing -

  • proxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent
  • proxyPort: Port for the proxy, defaults to 3128 when -proxyHost is used
  • proxyUser: Username for connecting to proxy (Basic Auth Only)
  • proxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified
bs_local_args = { "key": "<browserstack-accesskey>", "proxyHost": "127.0.0.1", "proxyPort": "8000", "proxyUser": "user", "proxyPass": "password"}

Local Proxy

To use local proxy in local testing -

  • localProxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent
  • localProxyPort: Port for the proxy, defaults to 8081 when -localProxyHost is used
  • localProxyUser: Username for connecting to proxy (Basic Auth Only)
  • localProxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified
bs_local_args = { "key": "<browserstack-accesskey>", "localProxyHost": "127.0.0.1", "localProxyPort": "8000", "-localProxyUser": "user", "-localProxyPass": "password"}

PAC (Proxy Auto-Configuration)

To use PAC (Proxy Auto-Configuration) in local testing -

  • pac-file: PAC (Proxy Auto-Configuration) file’s absolute path
bs_local_args = { "key": "<browserstack-accesskey>" , "-pac-file": "<pac_file_abs_path>"}

Local Identifier

If doing simultaneous multiple local testing connections, set this uniquely for different processes -

bs_local_args = { "key": "<browserstack-accesskey>" , "localIdentifier": "randomstring"}

Additional Arguments

Binary Path

By default, BrowserStack local wrappers try downloading and executing the latest version of BrowserStack binary in ~/.browserstack or the present working directory or the tmp folder by order. But you can override these by passing the -binarypath argument. Path to specify local Binary path -

bs_local_args = { "key": "<browserstack-accesskey>" , "binarypath": "/browserstack/BrowserStackLocal"}

Logfile

To save the logs to the file while running with the '-v' argument, you can specify the path of the file. By default the logs are saved in the local.log file in the present woring directory. To specify the path to file where the logs will be saved -

bs_local_args = { "key": "<browserstack-accesskey>" , "v": "true", "logfile": "/browserstack/logs.txt"}

Contribute

To run the test suite run, python -m unittest discover.

Reporting bugs

You can submit bug reports either in the Github issue tracker.

Before submitting an issue please check if there is already an existing issue. If there is, please add any additional information give it a "+1" in the comments.

When submitting an issue please describe the issue clearly, including how to reproduce the bug, which situations it appears in, what you expect to happen, what actually happens, and what platform (operating system and version) you are using.

Pull Requests

We love pull requests! We are very happy to work with you to get your changes merged in, however, please keep the following in mind.

  • Adhere to the coding conventions you see in the surrounding code.
  • Include tests, and make sure all tests pass.
  • Before submitting a pull-request, clean up the git history by going over your commits and squashing together minor changes and fixes into the corresponding commits. You can do this using the interactive rebase command.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

browserstack_local-1.2.16.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

browserstack_local-1.2.16-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file browserstack_local-1.2.16.tar.gz.

File metadata

  • Download URL: browserstack_local-1.2.16.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for browserstack_local-1.2.16.tar.gz
Algorithm Hash digest
SHA256 35742386288ac30b46dae497abaea75f9e76015dd5dbbb05d6f739c60362fa5e
MD5 7de7ce9ab45b05cefafaf79f4350b1e6
BLAKE2b-256 2fe80a4425aa3b53394811acfef5d389595940bc07fe6bc73258ba9ad6f6efac

See more details on using hashes here.

File details

Details for the file browserstack_local-1.2.16-py3-none-any.whl.

File metadata

File hashes

Hashes for browserstack_local-1.2.16-py3-none-any.whl
Algorithm Hash digest
SHA256 f591b7ab008f30d61a69e77f07c17e87cf19c40525985a42b08b8cb57015363d
MD5 699f9b7b40458212db3a00b083f47235
BLAKE2b-256 498a229b3d3434b73a705a5e85e8cabc0a0e2507d650fc634403a6ba76b12d79

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.2.16 This release

2 files

1.2.15

2 files

1.2.14

2 files

1.2.12

2 files

1.2.11

2 files

1.2.10

2 files

1.2.9

2 files

1.2.8

2 files

1.2.7

2 files

1.2.6

2 files

1.2.5

2 files

1.2.4

2 files

1.2.3

2 files

1.2.2

1 file

1.2.1

2 files

1.2.0

1 file

1.1.0

1 file

0.3.1

1 file

0.3.0

1 file

0.2

2 files

0.1.0

1 file

0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page