Python bindings for Browserstack Local
Maintained. Last release 4 months ago, commits in 4 of the last 26 weeks. Weaker on commit activity.
pip install browserstack-localbrowserstack-local-python
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