Class: SauceLabs::SauceBrowserFactory

Inherits:
Object
  • Object
show all
Includes:
ParsedValues
Defined in:
lib/saucelabs/sauce_browser_factory.rb

Overview

This class has the code necessary to create an instance of browser after making a connection to saucelabs. This class can also be used to create browser instance for local connections

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ParsedValues

#extract_values_from

Instance Attribute Details

#optionsObject

Returns the value of attribute options



13
14
15
# File 'lib/saucelabs/sauce_browser_factory.rb', line 13

def options
  @options
end

#persistent_httpObject

Returns the value of attribute persistent_http



13
14
15
# File 'lib/saucelabs/sauce_browser_factory.rb', line 13

def persistent_http
  @persistent_http
end

#urlObject

Returns the value of attribute url



13
14
15
# File 'lib/saucelabs/sauce_browser_factory.rb', line 13

def url
  @url
end

Instance Method Details

#selenium_driver(browser, browser_options) ⇒ Object

Creates a Selenium driver session and returns the driver object

SauceLabs.selenium_driver(browser = :chrome, browser_options = {})

Parameters:

  • the (String)

    browser string passed into the method

  • the (Hash)

    optional hash to specify browser options

Returns:

  • (Object)

    browser session



40
41
42
43
# File 'lib/saucelabs/sauce_browser_factory.rb', line 40

def selenium_driver(browser,browser_options)
  target,options = browser_caps(browser,browser_options)
  create_selenium_driver(target,options)
end

#watir_browser(browser, browser_options) ⇒ Object

Creates a watir browser session and returns the browser object

SauceLabs.watir_browser(browser = :chrome, browser_options = {})

Parameters:

  • the (String)

    browser string passed into the method

  • the (Hash)

    optional hash to specify browser options

Returns:

  • (Object)

    browser session



25
26
27
28
# File 'lib/saucelabs/sauce_browser_factory.rb', line 25

def watir_browser(browser,browser_options)
  target,options = browser_caps(browser,browser_options)
  create_watir_browser(target,options)
end