Package: browserstacker
Python wrapper forBrowserStackfeatures.InstallationThe current stable release:pip install browserstackeror:easy_install browserstackeror from source:$ sudo python setup.py installUsageTo start working with BrowserStack ScreenShots API simply type:>>>frombrowserstackerimportScreenShotsAPI>>>api=ScreenShotsAPI('user','key')>>>api.browsers()[{"os":"Windows","os_version":"XP","browser":"chrome","browser_version":"21.0","device":None},{"os":"ios","os_version":"6.0","browser":"Mobile Safari","browser_version":None,"device":"iPhone 4S (6.0)"}....]Optionally you can filter the output ofbrowsersbybrowser,browser_version,device,osoros_version.>>>api.browsers(os='Windows',browser='chrome')[{"os":"Windows","os_version":"8.1","browser":"chrome","browser_version":"22.0","device":None},{"os":"Windows","os_version":"8.1","browser":"chrome","browser_version":"23.0","device":None}....]Command line:$browserstackerbrowsers-osWindows-bchromeAvailablebrowsers:------browser_version:22.0os:Windowsbrowser:chromedevice:Noneos_version:8.1------...Totalbrowsers:100Filtration values are case insensitive and are casted to strings during filtration.
E.g. you can use integers for filtration byos_versionparameter.
Also it is possible to filter by multiple values:>>>api.browsers(os='Windows',browser=('chrome','firefox'))[{"os":"Windows","os_version":"8.1","browser":"chrome","browser_version":"22.0","device":None},{"os":"Windows","os_version":"8.1","browser":"firefox","browser_version":"16.0","device":None}....]Command line:$browserstackerbrowsers-osWindows-bchrome-bfirefoxAvailablebrowsers:------browser_version:22.0os:Windowsbrowser:chromedevice:Noneos_version:8.1------...Totalbrowsers:215To generate screenshots:>>>browser=api.browsers()[0]>>>response=api.generate('http://www.google.com',browser)Command line:$browserstackergeneratehttp://www.google.com-osWindows-bfirefox-bv37.0-ovXPHere you can pass single browsers or list of them.
You’ll get thejob_idfrom response. To list available screenshots forjob_id:>>>api.list(response['job_id']){"id":"13b93a14db22872fcb5fd1c86b730a51197db319","state":"done","callback_url":"http://staging.example.com","win_res":"1024x768","mac_res":"1920x1080","quality":"compressed","wait_time":5,"screenshots":[{"os":"Windows","os_version":"XP","browser":"ie","browser_version":"7.0","id":"be9989892cbba9b9edc2c95f403050aa4996ac6a","state":"done","url":"www.google.com","thumb_url":"https://www.browserstack.com/screenshots/13b93a14db22872fcb5fd1c86b730a51197db319/thumb_winxp_ie_7.0.jpg","image_url":"https://www.browserstack.com/screenshots/13b93a14db22872fcb5fd1c86b730a51197db319/winxp_ie_7.0.png","created_at":"2013-03-14 16:25:45 UTC",}]}Command line:$browserstackerlist13b93a14db22872fcb5fd1c86b730a51197db319To download screenshots:>>>api.download(response['job_id'],'path_to_screenshots_dir')Command line:$browserstackerdownload13b93a14db22872fcb5fd1c86b730a51197db319-dscreenshots_dirAll screenshots will be saved in ‘path_to_screenshots_dir’. Ifdestinationkwarg is absent, then screenshots will be
downloaded to current working directory.
Also you can use shortcut to create & download screenshots to your local machine:>>>response=api.make('http://www.google.com',browser,destination='path_to_screenshots_dir')Command line:$browserstackermake-osWindows-bfirefox-bv37.0-ovXP-dscreenshots_dirCommand line interfaceBrowserstacker comes with command line interface built withClick.
After installationbrowserstackerentry point will be available
It exposes almost the same API asScreenShotsAPIdoes. Does not support Python 3.2.To use CLI you have to pass user & key directly:$browserstacker-uuser-kkeybrowsersAvailablebrowsers:...Totalbrowsers:629Or via environment variables:$exportBROWSERSTACK_USER=user$exportBROWSERSTACK_KEY=key$browserstackerbrowsersHelp is also available:$browserstacker--helpUsage:browserstacker[OPTIONS]COMMAND[ARGS]...Options:-u,--userTEXTUsernameonBrowserStack-k,--keyTEXTAccesskey-v,--verbosityVerbositylevel--versionShowtheversionandexit.--helpShowthismessageandexit.Commands:downloadgeneratebrowserslistmakePython supportBrowserStacker supports Python 2.6, 2.7, 3.2, 3.3, 3.4, 3.5, PyPy, PyPy3 and Jython.NOTE. CLI does not support Python 3.2.