timeouts

Configure the amount of time that a particular type of operation can execute for before they are aborted and a Timeout error is returned to the client.

If no parameters are given it returns the current timeout settings (only supported by drivers which have the W3C Webdriver protocol implemented)

Usage

1
browser.timeouts([type][,ms]);

Parameters

Param Type Details
type
optional
String The type of operation to set the timeout for. Valid values are:
- script Determines when to interrupt a script that is being evaluated.
- implicit Gives the timeout of when to abort locating an element.
- pageLoad Provides the timeout limit used to interrupt navigation of the browsing context.
The pageLoad keyword is a part of the official WebDriver specification, but might not be supported for your browser (the previous name is page load).
ms
optional
Number The amount of time, in milliseconds, that time-limited commands are permitted to run.

Example

timeouts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
it('timeouts example', function() {
// set timeouts: not W3C WebDriver compatible call (old drivers)
browser.timeouts('script', 3000);

// set timeouts: W3C WebDriver compatible call (new drivers)
browser.timeouts({
"script": 1000,
"pageLoad": 7000,
"implicit": 5000
});

// get timeouts
const timeouts = browser.timeouts();
});