0.01
No commit activity in last 3 years
No release in over 3 years
Ruby gem for interacting with the Browserstack API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
= 2.11.0
= 1.8.11

Runtime

= 1.1.0
 Project Readme

Browserstack

A ruby gem for working with BrowserStack through its API.(V2 API only)

Installation

Add this line to your application's Gemfile:

gem 'browserstack'

And then execute:

$ bundle

Or install it yourself as:

$ gem install browserstack

Example of Use

First, you're probably gonna want to require it:

require 'browserstack'

Creating Client

Creates a new client instance.

  • settings: A hash of settings that apply to all requests for the new client.
    • username: The username for the BrowserStack account.
    • password: The password for the BrowserStack account.
client = Browserstack::Client.new(username: "foo", password: "foobar")

###API

####Getting available browsers Fetches all available browsers.

client.get_browsers #returns a hash

or for a specific OS

client.get_browsers("mac")

####Getting list of supported OS

client.get_supported_os_list 

####Creating a worker A worker is simply a new browser instance.

enc_url = URI.escape("http://example.com/?a=\111\\115")
settings = {os: "win", browser: "ie", version: "7.0", url: enc_url}
worker_id = client.create_worker(settings)

A worker id is returned after worker gets created.

  • settings: A hash of settings for the worker
    • os: Which OS to use for the new worker.
    • browser/device: Which browser/device to use in the new worker. Which property to use depends on the OS.
    • version: Which version of the specified browser to use.
    • url : Which URL to navigate to upon creation.
    • timeout (optional): defaults to 300 seconds. Use 0 for "forever" (BrowserStack will kill the worker after 1,800 seconds).

####Terminating a worker Use this method to terminate an active worker. A hash with indicating how long the worker was alive is returned.

data = client.terminate_worker(worker_id)

####Getting worker status Determines whether the worker is in queue, running or terminated.

worker = client.get_worker_status(worker_id)
  • worker: A hash representing the current status of the worker and worker properties.
    • returns an empty hash if worker is terminated.

####Getting all workers of a client

workers = client.get_workers

Returns an array of all workers with all their properties

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request