diff --git a/javascript/safari-driver/extension/commands.js b/javascript/safari-driver/extension/commands.js index 0228d2865588c..cc01fe1d450ec 100644 --- a/javascript/safari-driver/extension/commands.js +++ b/javascript/safari-driver/extension/commands.js @@ -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. diff --git a/javascript/safari-driver/extension/server.js b/javascript/safari-driver/extension/server.js index 2ae6fcb379afc..ac2ac1d4b9baf 100644 --- a/javascript/safari-driver/extension/server.js +++ b/javascript/safari-driver/extension/server.js @@ -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;