Class: SeleniumConnect::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium_connect/configuration.rb

Overview

Encapsulates the configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

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_timeoutObject

SauceLabs



19
20
21
# File 'lib/selenium_connect/configuration.rb', line 19

def api_timeout
  @api_timeout
end

#backgroundObject

Selenium Server



12
13
14
# File 'lib/selenium_connect/configuration.rb', line 12

def background
  @background
end

#browserObject

Returns the value of attribute browser.



21
22
23
# File 'lib/selenium_connect/configuration.rb', line 21

def browser
  @browser
end

#browser_pathObject

Browsers



16
17
18
# File 'lib/selenium_connect/configuration.rb', line 16

def browser_path
  @browser_path
end

#browser_versionObject

Returns the value of attribute browser_version.



21
22
23
# File 'lib/selenium_connect/configuration.rb', line 21

def browser_version
  @browser_version
end

#descriptionObject

Returns the value of attribute description.



21
22
23
# File 'lib/selenium_connect/configuration.rb', line 21

def description
  @description
end

#hostObject

Selenium Server



12
13
14
# File 'lib/selenium_connect/configuration.rb', line 12

def host
  @host
end

#jarObject

Selenium Server



12
13
14
# File 'lib/selenium_connect/configuration.rb', line 12

def jar
  @jar
end

#logObject

Selenium Server



12
13
14
# File 'lib/selenium_connect/configuration.rb', line 12

def log
  @log
end

#osObject

Returns the value of attribute os.



21
22
23
# File 'lib/selenium_connect/configuration.rb', line 21

def os
  @os
end

#portObject

Selenium Server



12
13
14
# File 'lib/selenium_connect/configuration.rb', line 12

def port
  @port
end

#profile_nameObject

Browsers



16
17
18
# File 'lib/selenium_connect/configuration.rb', line 16

def profile_name
  @profile_name
end

#profile_pathObject

Browsers



16
17
18
# File 'lib/selenium_connect/configuration.rb', line 16

def profile_path
  @profile_path
end

#sauce_api_keyObject

SauceLabs



19
20
21
# File 'lib/selenium_connect/configuration.rb', line 19

def sauce_api_key
  @sauce_api_key
end

#sauce_optsObject

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_usernameObject

SauceLabs



19
20
21
# File 'lib/selenium_connect/configuration.rb', line 19

def sauce_username
  @sauce_username
end

#versionObject

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