Class: SeleniumDSL::SeleniumWebdriver::DSL

Inherits:
Object
  • Object
show all
Includes:
SeleniumHelper
Defined in:
lib/selenium_dsl/selenium_webdriver/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SeleniumHelper

#construct_selenium_url

Constructor Details

#initialize(selenium_host, selenium_port, browser, capabilities = {}) ⇒ DSL

Returns a new instance of DSL.



14
15
16
17
18
19
20
21
# File 'lib/selenium_dsl/selenium_webdriver/dsl.rb', line 14

def initialize(selenium_host, selenium_port, browser, capabilities={})
  @driver = Selenium::WebDriver.for(:remote, :url => construct_selenium_url(selenium_host, selenium_port),
                                    :desired_capabilities => browser.to_sym)

  @driver.capabilities.merge(capabilities) unless capabilities.empty?

  @script = SeleniumDSL::SeleniumWebdriver::Script.new @driver
end

Instance Attribute Details

#driverObject (readonly)

Returns the value of attribute driver.



10
11
12
# File 'lib/selenium_dsl/selenium_webdriver/dsl.rb', line 10

def driver
  @driver
end

#scriptObject (readonly)

Returns the value of attribute script.



10
11
12
# File 'lib/selenium_dsl/selenium_webdriver/dsl.rb', line 10

def script
  @script
end

#timeout_in_seconds=(timeout_in_seconds) ⇒ Object (writeonly)

Sets the attribute timeout_in_seconds

Parameters:

  • value

    the value to set the attribute timeout_in_seconds to.



12
13
14
# File 'lib/selenium_dsl/selenium_webdriver/dsl.rb', line 12

def timeout_in_seconds=(value)
  @timeout_in_seconds = value
end

Instance Method Details

#selenium_webdriver(&block) ⇒ Object



35
36
37
38
39
# File 'lib/selenium_dsl/selenium_webdriver/dsl.rb', line 35

def selenium_webdriver(&block)
  @script.instance_eval(&block)

  @script
end

#startObject



28
29
# File 'lib/selenium_dsl/selenium_webdriver/dsl.rb', line 28

def start
end

#stopObject



31
32
33
# File 'lib/selenium_dsl/selenium_webdriver/dsl.rb', line 31

def stop
  @driver.quit
end