Skip to content

Commit 73a0ad2

Browse files
committed
adding 'timeouts' command mapping to safari driver
1 parent 9deedd4 commit 73a0ad2

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

javascript/safari-driver/extension/commands.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,23 @@ safaridriver.extension.commands.implicitlyWait = function(session, command) {
257257
/** @type {number} */ (command.getParameter('ms')) || 0);
258258
};
259259

260+
/**
261+
* Updates the various timeouts for the driver
262+
* @param {!safaridriver.extension.Session} session The session object.
263+
* @param {!safaridriver.Command} command The command object.
264+
*/
265+
safaridriver.extension.commands.setDriverTimeout = function(session, command) {
266+
var timeoutType = command.getParameter('type');
267+
if (timeoutType == 'implicit') {
268+
session.setImplicitWait(
269+
/** @type {number} */ (command.getParameter('ms')) || 0);
270+
} else if (timeoutType == 'page load') {
271+
// TODO
272+
} else if (timeoutType == 'script'){
273+
session.setScriptTimeout(
274+
/** @type {number} */ (command.getParameter('ms')) || 0);
275+
}
276+
}
260277

261278
/**
262279
* Updates the async script timeout setting for the given session.

javascript/safari-driver/extension/server.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ map[CommandName.GET_ALL_COOKIES] = commands.sendCommand;
109109
map[CommandName.DELETE_ALL_COOKIES] = commands.sendCommand;
110110
map[CommandName.DELETE_COOKIE] = commands.sendCommand;
111111

112+
map[CommandName.SET_TIMEOUT] = commands.setDriverTimeout;
112113
map[CommandName.IMPLICITLY_WAIT] = commands.implicitlyWait;
113114
map[CommandName.FIND_ELEMENT] = commands.findElement;
114115
map[CommandName.FIND_ELEMENTS] = commands.findElement;

0 commit comments

Comments
 (0)