class SeleniumConnect::Configuration
Encapsulates the configuration
Attributes
api_timeout[RW]
SauceLabs
background[RW]
Selenium Server
browser[R]
browser_path[RW]
Browsers
browser_version[R]
description[R]
host[RW]
Selenium Server
jar[RW]
Selenium Server
log[RW]
Selenium Server
os[R]
port[RW]
Selenium Server
profile_name[RW]
Browsers
profile_path[RW]
Browsers
sauce_api_key[RW]
SauceLabs
sauce_opts[R]
sauce_username[RW]
SauceLabs
version[RW]
Selenium Server
Public Class Methods
new(opts = {})
click to toggle source
# File lib/selenium_connect/configuration.rb, line 23 def initialize(opts = {}) @host = 'localhost' @port = 4444 @browser = 'firefox' @sauce_opts = OpenStruct.new @sauce_opts.selenium_version = '2.32.0' populate_with_hash opts unless opts.empty? end
Public Instance Methods
browser=(browser)
click to toggle source
# File lib/selenium_connect/configuration.rb, line 72 def browser=(browser) @browser = browser @sauce_opts.browser = browser if @sauce_opts.browser.nil? end
browser_version=(browser_version)
click to toggle source
# File lib/selenium_connect/configuration.rb, line 62 def browser_version=(browser_version) @browser_version = browser_version @sauce_opts.browser_version = browser_version if @sauce_opts.browser_version.nil? end
description=(description)
click to toggle source
# File lib/selenium_connect/configuration.rb, line 67 def description=(description) @description = description @sauce_opts.job_name = description if @sauce_opts.job_name.nil? end
os=(os)
click to toggle source
The below methods are setters for the explicitly defined sauce and browser options, the is support future refactoring to a strutted config but maintains compatability for now.
# File lib/selenium_connect/configuration.rb, line 57 def os=(os) @os = os @sauce_opts.os = os end
populate_with_hash(hash)
click to toggle source
# File lib/selenium_connect/configuration.rb, line 40 def populate_with_hash(hash) hash.each do |key, value| begin send "#{key}=", value unless value.nil? rescue NoMethodError raise ArgumentError.new "The config key: \"#{key}\" is unknown!" end end end
populate_with_yaml(file)
click to toggle source
# File lib/selenium_connect/configuration.rb, line 50 def populate_with_yaml(file) populate_with_hash YAML.load_file file end
Also aliased as: config_file=
sauce_opts=(opts = {})
click to toggle source
TODO: eventually roll all sauce options under this node and deprecate setting them at the top level
# File lib/selenium_connect/configuration.rb, line 34 def sauce_opts=(opts = {}) opts.each do |key, value| @sauce_opts.send("#{key}=", value) unless value.nil? end end