Class: SeleniumConnect::Configuration
- Inherits:
-
Object
- Object
- SeleniumConnect::Configuration
- Defined in:
- lib/selenium_connect/configuration.rb
Overview
Encapsulates the configuration
Instance Attribute Summary collapse
-
#api_timeout ⇒ Object
SauceLabs.
-
#background ⇒ Object
Selenium Server.
-
#browser ⇒ Object
Returns the value of attribute browser.
-
#browser_path ⇒ Object
Browsers.
-
#browser_version ⇒ Object
Returns the value of attribute browser_version.
-
#description ⇒ Object
Returns the value of attribute description.
-
#host ⇒ Object
Selenium Server.
-
#jar ⇒ Object
Selenium Server.
-
#log ⇒ Object
Selenium Server.
-
#os ⇒ Object
Returns the value of attribute os.
-
#port ⇒ Object
Selenium Server.
-
#profile_name ⇒ Object
Browsers.
-
#profile_path ⇒ Object
Browsers.
-
#sauce_api_key ⇒ Object
SauceLabs.
-
#sauce_opts ⇒ Object
Returns the value of attribute sauce_opts.
-
#sauce_username ⇒ Object
SauceLabs.
-
#version ⇒ Object
Selenium Server.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #populate_with_hash(hash) ⇒ Object
- #populate_with_yaml(file) ⇒ Object (also: #config_file=)
Constructor Details
#initialize(opts = {}) ⇒ Configuration
Returns a new instance of Configuration.
23 24 25 26 27 28 29 30 |
# 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 |
Instance Attribute Details
#api_timeout ⇒ Object
SauceLabs
19 20 21 |
# File 'lib/selenium_connect/configuration.rb', line 19 def api_timeout @api_timeout end |
#background ⇒ Object
Selenium Server
12 13 14 |
# File 'lib/selenium_connect/configuration.rb', line 12 def background @background end |
#browser ⇒ Object
Returns the value of attribute browser.
21 22 23 |
# File 'lib/selenium_connect/configuration.rb', line 21 def browser @browser end |
#browser_path ⇒ Object
Browsers
16 17 18 |
# File 'lib/selenium_connect/configuration.rb', line 16 def browser_path @browser_path end |
#browser_version ⇒ Object
Returns the value of attribute browser_version.
21 22 23 |
# File 'lib/selenium_connect/configuration.rb', line 21 def browser_version @browser_version end |
#description ⇒ Object
Returns the value of attribute description.
21 22 23 |
# File 'lib/selenium_connect/configuration.rb', line 21 def description @description end |
#host ⇒ Object
Selenium Server
12 13 14 |
# File 'lib/selenium_connect/configuration.rb', line 12 def host @host end |
#jar ⇒ Object
Selenium Server
12 13 14 |
# File 'lib/selenium_connect/configuration.rb', line 12 def jar @jar end |
#log ⇒ Object
Selenium Server
12 13 14 |
# File 'lib/selenium_connect/configuration.rb', line 12 def log @log end |
#os ⇒ Object
Returns the value of attribute os.
21 22 23 |
# File 'lib/selenium_connect/configuration.rb', line 21 def os @os end |
#port ⇒ Object
Selenium Server
12 13 14 |
# File 'lib/selenium_connect/configuration.rb', line 12 def port @port end |
#profile_name ⇒ Object
Browsers
16 17 18 |
# File 'lib/selenium_connect/configuration.rb', line 16 def profile_name @profile_name end |
#profile_path ⇒ Object
Browsers
16 17 18 |
# File 'lib/selenium_connect/configuration.rb', line 16 def profile_path @profile_path end |
#sauce_api_key ⇒ Object
SauceLabs
19 20 21 |
# File 'lib/selenium_connect/configuration.rb', line 19 def sauce_api_key @sauce_api_key end |
#sauce_opts ⇒ Object
Returns the value of attribute sauce_opts.
21 22 23 |
# File 'lib/selenium_connect/configuration.rb', line 21 def sauce_opts @sauce_opts end |
#sauce_username ⇒ Object
SauceLabs
19 20 21 |
# File 'lib/selenium_connect/configuration.rb', line 19 def sauce_username @sauce_username end |
#version ⇒ Object
Selenium Server
12 13 14 |
# File 'lib/selenium_connect/configuration.rb', line 12 def version @version end |
Instance Method Details
#populate_with_hash(hash) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# 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) ⇒ Object Also known as: config_file=
50 51 52 |
# File 'lib/selenium_connect/configuration.rb', line 50 def populate_with_yaml(file) populate_with_hash YAML.load_file file end |