Class: Selenium::WebDriver::Timeouts

Inherits:
Object
  • Object
show all
Defined in:
rb/lib/selenium/webdriver/common/timeouts.rb

Instance Method Summary collapse

Constructor Details

#initialize(bridge) ⇒ Timeouts

Returns a new instance of Timeouts.



23
24
25
# File 'rb/lib/selenium/webdriver/common/timeouts.rb', line 23

def initialize(bridge)
  @bridge = bridge
end

Instance Method Details

#implicit_waitObject

Gets the amount of time the driver should wait when searching for elements.



31
32
33
# File 'rb/lib/selenium/webdriver/common/timeouts.rb', line 31

def implicit_wait
  Float(@bridge.timeouts['implicit']) / 1000
end

#implicit_wait=(seconds) ⇒ Object

Set the amount of time the driver should wait when searching for elements.



39
40
41
# File 'rb/lib/selenium/webdriver/common/timeouts.rb', line 39

def implicit_wait=(seconds)
  @bridge.timeouts = {'implicit' => Integer(seconds * 1000)}
end

#page_loadObject

Gets the amount of time to wait for a page load to complete before throwing an error.



68
69
70
# File 'rb/lib/selenium/webdriver/common/timeouts.rb', line 68

def page_load
  Float(@bridge.timeouts['pageLoad']) / 1000
end

#page_load=(seconds) ⇒ Object

Sets the amount of time to wait for a page load to complete before throwing an error. If the timeout is negative, page loads can be indefinite.



77
78
79
# File 'rb/lib/selenium/webdriver/common/timeouts.rb', line 77

def page_load=(seconds)
  @bridge.timeouts = {'pageLoad' => Integer(seconds * 1000)}
end

#scriptObject Also known as: script_timeout

Gets the amount of time to wait for an asynchronous script to finish execution before throwing an error.



48
49
50
# File 'rb/lib/selenium/webdriver/common/timeouts.rb', line 48

def script
  Float(@bridge.timeouts['script']) / 1000
end

#script=(seconds) ⇒ Object Also known as: script_timeout=

Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error. If the timeout is negative, then the script will be allowed to run indefinitely.



59
60
61
# File 'rb/lib/selenium/webdriver/common/timeouts.rb', line 59

def script=(seconds)
  @bridge.timeouts = {'script' => Integer(seconds * 1000)}
end