Skip to content

Commit

Permalink
adding 'timeouts' command mapping to safari driver
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeis committed Oct 12, 2015
1 parent 9deedd4 commit 73a0ad2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions javascript/safari-driver/extension/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,23 @@ safaridriver.extension.commands.implicitlyWait = function(session, command) {
/** @type {number} */ (command.getParameter('ms')) || 0);
};

/**
* Updates the various timeouts for the driver
* @param {!safaridriver.extension.Session} session The session object.
* @param {!safaridriver.Command} command The command object.
*/
safaridriver.extension.commands.setDriverTimeout = function(session, command) {
var timeoutType = command.getParameter('type');
if (timeoutType == 'implicit') {
session.setImplicitWait(
/** @type {number} */ (command.getParameter('ms')) || 0);
} else if (timeoutType == 'page load') {
// TODO
} else if (timeoutType == 'script'){
session.setScriptTimeout(
/** @type {number} */ (command.getParameter('ms')) || 0);
}
}

/**
* Updates the async script timeout setting for the given session.
Expand Down
1 change: 1 addition & 0 deletions javascript/safari-driver/extension/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ map[CommandName.GET_ALL_COOKIES] = commands.sendCommand;
map[CommandName.DELETE_ALL_COOKIES] = commands.sendCommand;
map[CommandName.DELETE_COOKIE] = commands.sendCommand;

map[CommandName.SET_TIMEOUT] = commands.setDriverTimeout;
map[CommandName.IMPLICITLY_WAIT] = commands.implicitlyWait;
map[CommandName.FIND_ELEMENT] = commands.findElement;
map[CommandName.FIND_ELEMENTS] = commands.findElement;
Expand Down

0 comments on commit 73a0ad2

Please sign in to comment.