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.



22
23
24
25
26
27
# File 'lib/selenium_connect/configuration.rb', line 22

def initialize(opts = {})
  @host     = 'localhost'
  @port     = 4444
  @browser  = 'firefox'
  populate_with_hash opts unless opts.empty?
end

Instance Attribute Details

#backgroundObject

Selenium Server



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

def background
  @background
end

#browserObject

Browsers



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

def browser
  @browser
end

#browser_pathObject

Browsers



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

def browser_path
  @browser_path
end

#browser_versionObject

SauceLabs



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

def browser_version
  @browser_version
end

#descriptionObject

SauceLabs



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

def description
  @description
end

#hostObject

Selenium Server



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

def host
  @host
end

#jarObject

Selenium Server



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

def jar
  @jar
end

#logObject

Selenium Server



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

def log
  @log
end

#osObject

SauceLabs



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

def os
  @os
end

#portObject

Selenium Server



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

def port
  @port
end

#profile_nameObject

Browsers



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

def profile_name
  @profile_name
end

#profile_pathObject

Browsers



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

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_usernameObject

SauceLabs



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

def sauce_username
  @sauce_username
end

#versionObject

Selenium Server



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

def version
  @version
end

Instance Method Details

#populate_with_hash(hash) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/selenium_connect/configuration.rb', line 29

def populate_with_hash(hash)
  hash.each do |key, value|
    begin
      self.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=



39
40
41
# File 'lib/selenium_connect/configuration.rb', line 39

def populate_with_yaml(file)
    populate_with_hash YAML.load_file file
end