From 73a0ad20dec40b4d29527ca757a4a1d1c99164f4 Mon Sep 17 00:00:00 2001 From: Luke Inman-Semerau Date: Mon, 12 Oct 2015 10:59:09 -0700 Subject: [PATCH] adding 'timeouts' command mapping to safari driver --- javascript/safari-driver/extension/commands.js | 17 +++++++++++++++++ javascript/safari-driver/extension/server.js | 1 + 2 files changed, 18 insertions(+) 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;