Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 111cb0e

Browse files
committed
feat: Implement timeouts method
1 parent 3520539 commit 111cb0e

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Method | Description
6060
`driver.refresh()` | Refreshes the browser.
6161
`driver.getElement(cssSelector)` | Finds an element on the page using the `cssSelector` and returns an Element.
6262
`driver.getElements(cssSelector)` | Finds all elements on the page using the `cssSelector` and returns an array of Elements.
63+
`driver.setTimeouts(type, milliseconds)` | Sets a timeout for a certain type of operation. Valid types are: "script" for script timeouts, "implicit" for modifying the implicit wait timeout and "page load" for setting a page load timeout.
6364
`driver.setElementTimeout(milliseconds)` | Sets a timeout for WebDriver to find elements with `getElement` and `getElements`.
6465
`driver.setScriptTimeout(milliseconds)` | Sets a timeout for WebDriver to execute async scripts with `evaluateAsync`.
6566
`driver.getUrl()` | Returns the current url of the page.
@@ -112,7 +113,7 @@ Status | HTTP Method | Path | Summary
112113
![Not Yet Implemented](./docs/not_implemented.png "Not Yet Implemented") | GET | `/sessions` | Returns a list of the currently active sessions.
113114
![Not Yet Implemented](./docs/not_implemented.png "Not Yet Implemented") | GET | `/session/:sessionId` | Retrieve the capabilities of the specified session.
114115
![Implemented](./docs/implemented.png "Implemented") | DELETE | `/session/:sessionId` | Delete the session.
115-
![Not Yet Implemented](./docs/not_implemented.png "Not Yet Implemented") | POST | `/session/:sessionId/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.
116+
![Implemented](./docs/implemented.png "Implemented") | POST | `/session/:sessionId/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.
116117
![Implemented](./docs/implemented.png "Implemented") | POST | `/session/:sessionId/timeouts/async_script` | Set the amount of time, in milliseconds, that asynchronous scripts executed by `/session/:sessionId/execute_async` are permitted to run before they are aborted and a `Timeout` error is returned to the client.
117118
![Implemented](./docs/implemented.png "Implemented") | POST | `/session/:sessionId/timeouts/implicit_wait` | Set the amount of time the driver should wait when searching for elements.
118119
![Implemented](./docs/implemented.png "Implemented") | GET | `/session/:sessionId/window_handle` | Retrieve the current window handle.

lib/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ module.exports = WebDriver = (function() {
9696
this.http["delete"]('');
9797
};
9898

99+
WebDriver.prototype.setTimeouts = function(type, ms) {
100+
this.http.post("/timeouts", {
101+
type: type,
102+
ms: ms
103+
});
104+
};
105+
99106
WebDriver.prototype.setScriptTimeout = function(ms) {
100107
this.http.post("/timeouts/async_script", {
101108
ms: ms

src/index.coffee

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ module.exports = class WebDriver
7777
@http.delete ''
7878
return
7979

80+
setTimeouts: (type, ms) ->
81+
@http.post "/timeouts", { type, ms }
82+
return
83+
8084
setScriptTimeout: (ms) ->
8185
@http.post "/timeouts/async_script", { ms }
8286
return

0 commit comments

Comments
 (0)