diff --git a/javascript/atoms/error.js b/javascript/atoms/error.js index 2c3ec6c550cb6..32d80b833fbce 100644 --- a/javascript/atoms/error.js +++ b/javascript/atoms/error.js @@ -25,7 +25,40 @@ goog.provide('bot.ErrorCode'); /** - * Error codes from the WebDriver wire protocol: + * Status strings enumerated in the W3C WebDriver protocol. + * @enum {string} + * @see https://w3c.github.io/webdriver/webdriver-spec.html#handling-errors + */ +bot.Error.State = { + ELEMENT_NOT_SELECTABLE: 'element not selectable', + ELEMENT_NOT_VISIBLE: 'element not visible', + INVALID_ARGUMENT: 'invalid argument', + INVALID_COOKIE_DOMAIN: 'invalid cookie domain', + INVALID_ELEMENT_COORDINATES: 'invalid element coordinates', + INVALID_ELEMENT_STATE: 'invalid element state', + INVALID_SELECTOR: 'invalid selector', + INVALID_SESSION_ID: 'invalid session id', + JAVASCRIPT_ERROR: 'javascript error', + MOVE_TARGET_OUT_OF_BOUNDS: 'move target out of bounds', + NO_SUCH_ALERT: 'no such alert', + NO_SUCH_ELEMENT: 'no such element', + NO_SUCH_FRAME: 'no such frame', + NO_SUCH_WINDOW: 'no such window', + SCRIPT_TIMEOUT: 'script timeout', + SESSION_NOT_CREATED: 'session not created', + STALE_ELEMENT_REFERENCE: 'stale element reference', + TIMEOUT: 'timeout', + UNABLE_TO_SET_COOKIE: 'unable to set cookie', + UNEXPECTED_ALERT_OPEN: 'unexpected alert open', + UNKNOWN_COMMAND: 'unknown command', + UNKNOWN_ERROR: 'unknown error', + UNKNOWN_METHOD: 'unknown method', + UNSUPPORTED_OPERATION: 'unsupported operation' +}; + + +/** + * Error codes from the Selenium WebDriver protocol: * https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#response-status-codes * * @enum {number} @@ -66,9 +99,7 @@ bot.ErrorCode = { /** - * Error extension that includes error status codes from the WebDriver wire - * protocol: - * https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#response-status-codes + * Represents an error returned from a WebDriver command request. * * @param {!bot.ErrorCode} code The error's status code. * @param {string=} opt_message Optional error message. @@ -116,39 +147,6 @@ bot.Error = function(code, opt_message) { goog.inherits(bot.Error, Error); -/** - * Status strings enumerated in the W3C WebDriver working draft. - * @enum {string} - * @see http://www.w3.org/TR/webdriver/#status-codes - */ -bot.Error.State = { - ELEMENT_NOT_SELECTABLE: 'element not selectable', - ELEMENT_NOT_VISIBLE: 'element not visible', - INVALID_ARGUMENT: 'invalid argument', - INVALID_COOKIE_DOMAIN: 'invalid cookie domain', - INVALID_ELEMENT_COORDINATES: 'invalid element coordinates', - INVALID_ELEMENT_STATE: 'invalid element state', - INVALID_SELECTOR: 'invalid selector', - INVALID_SESSION_ID: 'invalid session id', - JAVASCRIPT_ERROR: 'javascript error', - MOVE_TARGET_OUT_OF_BOUNDS: 'move target out of bounds', - NO_SUCH_ALERT: 'no such alert', - NO_SUCH_ELEMENT: 'no such element', - NO_SUCH_FRAME: 'no such frame', - NO_SUCH_WINDOW: 'no such window', - SCRIPT_TIMEOUT: 'script timeout', - SESSION_NOT_CREATED: 'session not created', - STALE_ELEMENT_REFERENCE: 'stale element reference', - TIMEOUT: 'timeout', - UNABLE_TO_SET_COOKIE: 'unable to set cookie', - UNEXPECTED_ALERT_OPEN: 'unexpected alert open', - UNKNOWN_COMMAND: 'unknown command', - UNKNOWN_ERROR: 'unknown error', - UNKNOWN_METHOD: 'unknown method', - UNSUPPORTED_OPERATION: 'unsupported operation' -}; - - /** * A map of error codes to state string. * @private {!Object.}