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 Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(browser, browserstack_options, device_options = {}, options = Options.for(browser)) ⇒ 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

  • device_options (optional) - A Hash of all device specific options that can customise your device

    • :device_name (String) -> The name of your device

    • :os_version (String) -> The operating system for your device

  • options (optional) -> You can instantiate an Options payload that can be used when registering your driver



37
38
39
40
41
42
# File 'lib/automation_helpers/drivers/v4/browserstack.rb', line 37

def initialize(browser, browserstack_options, device_options = {}, options = Options.for(browser))
  @browser = browser
  @browserstack_options = browserstack_options
  @device_options = device_options
  @options = options
end

Instance Attribute Details

#browserObject (readonly)

Returns the value of attribute browser.



17
18
19
# File 'lib/automation_helpers/drivers/v4/browserstack.rb', line 17

def browser
  @browser
end

#browserstack_optionsObject (readonly)

Returns the value of attribute browserstack_options.



17
18
19
# File 'lib/automation_helpers/drivers/v4/browserstack.rb', line 17

def browserstack_options
  @browserstack_options
end

#device_optionsObject (readonly)

Returns the value of attribute device_options.



17
18
19
# File 'lib/automation_helpers/drivers/v4/browserstack.rb', line 17

def device_options
  @device_options
end

#optionsObject (readonly)

Returns the value of attribute options.



17
18
19
# File 'lib/automation_helpers/drivers/v4/browserstack.rb', line 17

def options
  @options
end

Instance Method Details

#registerNil

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

Returns:

  • (Nil)


47
48
49
50
51
52
53
54
55
56
# File 'lib/automation_helpers/drivers/v4/browserstack.rb', line 47

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