Module: Async::WebDriver::Scope::Timeouts

Included in:
Async::WebDriver::Session
Defined in:
lib/async/webdriver/scope/timeouts.rb

Overview

Helpers for working with timeouts.

If your tests are failing because the page is not loading fast enough, you can increase the page load timeout:

“‘ ruby session.script_timeout = 1000 # 1 second session.implicit_wait_timeout = 10_000 # 10 seconds session.page_load_timeout = 60_000 # 60 seconds “`

Instance Method Summary collapse

Instance Method Details

#implicit_wait_timeoutObject

The implicit wait timeout is the amount of time the driver should wait when searching for elements.



39
40
41
# File 'lib/async/webdriver/scope/timeouts.rb', line 39

def implicit_wait_timeout
	timeouts["implicit"]
end

#implicit_wait_timeout=(value) ⇒ Object

Set the implicit wait timeout.



45
46
47
# File 'lib/async/webdriver/scope/timeouts.rb', line 45

def implicit_wait_timeout=(value)
	session.post("timeouts", {implicit: value})
end

#page_load_timeoutObject

The page load timeout is the amount of time the driver should wait when loading a page.



51
52
53
# File 'lib/async/webdriver/scope/timeouts.rb', line 51

def page_load_timeout
	timeouts["pageLoad"]
end

#page_load_timeout=(value) ⇒ Object

Set the page load timeout.



57
58
59
# File 'lib/async/webdriver/scope/timeouts.rb', line 57

def page_load_timeout=(value)
	session.post("timeouts", {pageLoad: value})
end

#script_timeoutObject

The script timeout is the amount of time the driver should wait when executing JavaScript asynchronously.



27
28
29
# File 'lib/async/webdriver/scope/timeouts.rb', line 27

def script_timeout
	timeouts["script"]
end

#script_timeout=(value) ⇒ Object

Set the script timeout.



33
34
35
# File 'lib/async/webdriver/scope/timeouts.rb', line 33

def script_timeout=(value)
	session.post("timeouts", {script: value})
end

#timeoutsObject

Get the current timeouts.



21
22
23
# File 'lib/async/webdriver/scope/timeouts.rb', line 21

def timeouts
	session.get("timeouts")
end