Class: AutomationHelpers::Drivers::V4::Browserstack

Inherits:
Object
  • Object
show all
Defined in:
lib/automation_helpers/drivers/v4/browserstack.rb

Overview

The Browserstack Driver that will connect to a hosted grid This requires a series of pre-set values to be passed in

Instance Method Summary collapse

Constructor Details

#initialize(browser, browserstack_options, device_options = {}) ⇒ Browserstack

#### Initial setup options

  • browser (required) - When instantiating, the first argument must be the symbol that represents what browser to use

  • browserstack_options (required) - A Hash of all required options that will be parsed and used to setup the driver

    • :build_name (String) -> The build name to be stored on browserstack servers

    • :project_name (String) -> The project name to be stored on browserstack servers

    • :session_name (String) -> The session name to be stored on browserstack servers

    • :browserstack_debug_mode (Boolean) -> Set this to true to run in browserstack debug mode (Note this runs slower!)

    • :config (String) -> This is an underscore separated key that distils the granular running information i.e. Windows_7_86 means run on Windows Operating System, OS Version 7, Browser Version 86 i.e. OSX_Mojave_12 means run on Mac Operating System, OS Version Mojave, Browser Version 12 i.e. Windows_10_92 means run on Windows Operating System, OS Version 10, Browser Version 92

    • :username (String) -> The username for Browserstack

    • :api_key (String) -> The api key for Browserstack



35
36
37
38
39
# File 'lib/automation_helpers/drivers/v4/browserstack.rb', line 35

def initialize(browser, browserstack_options, device_options = {})
  @browser = browser
  @browserstack_options = browserstack_options
  @device_options = device_options
end

Instance Method Details

#registerNil

Register a new driver with the default selenium name for use in a remote browserstack setup

Returns:

  • (Nil)


44
45
46
47
48
49
50
51
52
53
# File 'lib/automation_helpers/drivers/v4/browserstack.rb', line 44

def register
  Capybara.register_driver :selenium do |app|
    Capybara::Selenium::Driver.new(
      app,
      browser: :remote,
      capabilities: [desired_capabilities, options],
      url: browserstack_hub_url
    )
  end
end