org.openqa.selenium.remote
Class ErrorCodes

java.lang.Object
  extended by org.openqa.selenium.remote.ErrorCodes

public class ErrorCodes
extends Object

Defines common error codes for the wire protocol.

Author:
[email protected] (Jason Leyba)

Field Summary
static int ASYNC_SCRIPT_TIMEOUT
           
static int ELEMENT_NOT_SELECTABLE
           
static int ELEMENT_NOT_VISIBLE
           
static int IME_ENGINE_ACTIVATION_FAILED
           
static int IME_NOT_AVAILABLE
           
static int INVALID_COOKIE_DOMAIN
           
static int INVALID_ELEMENT_COORDINATES
           
static int INVALID_ELEMENT_STATE
           
static int INVALID_SELECTOR_ERROR
           
static int INVALID_XPATH_SELECTOR
           
static int INVALID_XPATH_SELECTOR_RETURN_TYPER
           
static int JAVASCRIPT_ERROR
           
static int METHOD_NOT_ALLOWED
           
static int MOVE_TARGET_OUT_OF_BOUNDS
           
static int NO_ALERT_PRESENT
           
static int NO_SUCH_ELEMENT
           
static int NO_SUCH_FRAME
           
static int NO_SUCH_SESSION
           
static int NO_SUCH_WINDOW
           
static int SESSION_NOT_CREATED
           
static int SQL_DATABASE_ERROR
           
static int STALE_ELEMENT_REFERENCE
           
static int SUCCESS
           
static int TIMEOUT
           
static int UNABLE_TO_SET_COOKIE
           
static int UNEXPECTED_ALERT_PRESENT
           
static int UNHANDLED_ERROR
           
static int UNKNOWN_COMMAND
           
static int XPATH_LOOKUP_ERROR
           
 
Constructor Summary
ErrorCodes()
           
 
Method Summary
 Class<? extends WebDriverException> getExceptionType(int statusCode)
          Returns the exception type that corresponds to the given statusCode.
 boolean isMappableError(Throwable thrown)
          Tests if the thrown error can be mapped to one of WebDriver's well defined error codes.
 int toStatusCode(Throwable thrown)
          Converts a thrown error into the corresponding status code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUCCESS

public static final int SUCCESS
See Also:
Constant Field Values

NO_SUCH_SESSION

public static final int NO_SUCH_SESSION
See Also:
Constant Field Values

NO_SUCH_ELEMENT

public static final int NO_SUCH_ELEMENT
See Also:
Constant Field Values

NO_SUCH_FRAME

public static final int NO_SUCH_FRAME
See Also:
Constant Field Values

UNKNOWN_COMMAND

public static final int UNKNOWN_COMMAND
See Also:
Constant Field Values

STALE_ELEMENT_REFERENCE

public static final int STALE_ELEMENT_REFERENCE
See Also:
Constant Field Values

ELEMENT_NOT_VISIBLE

public static final int ELEMENT_NOT_VISIBLE
See Also:
Constant Field Values

INVALID_ELEMENT_STATE

public static final int INVALID_ELEMENT_STATE
See Also:
Constant Field Values

UNHANDLED_ERROR

public static final int UNHANDLED_ERROR
See Also:
Constant Field Values

ELEMENT_NOT_SELECTABLE

public static final int ELEMENT_NOT_SELECTABLE
See Also:
Constant Field Values

JAVASCRIPT_ERROR

public static final int JAVASCRIPT_ERROR
See Also:
Constant Field Values

XPATH_LOOKUP_ERROR

public static final int XPATH_LOOKUP_ERROR
See Also:
Constant Field Values

TIMEOUT

public static final int TIMEOUT
See Also:
Constant Field Values

NO_SUCH_WINDOW

public static final int NO_SUCH_WINDOW
See Also:
Constant Field Values

INVALID_COOKIE_DOMAIN

public static final int INVALID_COOKIE_DOMAIN
See Also:
Constant Field Values

UNABLE_TO_SET_COOKIE

public static final int UNABLE_TO_SET_COOKIE
See Also:
Constant Field Values

UNEXPECTED_ALERT_PRESENT

public static final int UNEXPECTED_ALERT_PRESENT
See Also:
Constant Field Values

NO_ALERT_PRESENT

public static final int NO_ALERT_PRESENT
See Also:
Constant Field Values

ASYNC_SCRIPT_TIMEOUT

public static final int ASYNC_SCRIPT_TIMEOUT
See Also:
Constant Field Values

INVALID_ELEMENT_COORDINATES

public static final int INVALID_ELEMENT_COORDINATES
See Also:
Constant Field Values

IME_NOT_AVAILABLE

public static final int IME_NOT_AVAILABLE
See Also:
Constant Field Values

IME_ENGINE_ACTIVATION_FAILED

public static final int IME_ENGINE_ACTIVATION_FAILED
See Also:
Constant Field Values

INVALID_SELECTOR_ERROR

public static final int INVALID_SELECTOR_ERROR
See Also:
Constant Field Values

SESSION_NOT_CREATED

public static final int SESSION_NOT_CREATED
See Also:
Constant Field Values

MOVE_TARGET_OUT_OF_BOUNDS

public static final int MOVE_TARGET_OUT_OF_BOUNDS
See Also:
Constant Field Values

SQL_DATABASE_ERROR

public static final int SQL_DATABASE_ERROR
See Also:
Constant Field Values

INVALID_XPATH_SELECTOR

public static final int INVALID_XPATH_SELECTOR
See Also:
Constant Field Values

INVALID_XPATH_SELECTOR_RETURN_TYPER

public static final int INVALID_XPATH_SELECTOR_RETURN_TYPER
See Also:
Constant Field Values

METHOD_NOT_ALLOWED

public static final int METHOD_NOT_ALLOWED
See Also:
Constant Field Values
Constructor Detail

ErrorCodes

public ErrorCodes()
Method Detail

getExceptionType

public Class<? extends WebDriverException> getExceptionType(int statusCode)
Returns the exception type that corresponds to the given statusCode. All unrecognized status codes will be mapped to WebDriverException.class.

Parameters:
statusCode - The status code to convert.
Returns:
The exception type that corresponds to the provided status code or null if statusCode == 0.

toStatusCode

public int toStatusCode(Throwable thrown)
Converts a thrown error into the corresponding status code.

Parameters:
thrown - The thrown error.
Returns:
The corresponding status code for the given thrown error.

isMappableError

public boolean isMappableError(Throwable thrown)
Tests if the thrown error can be mapped to one of WebDriver's well defined error codes.

Parameters:
thrown - The error to test.
Returns:
Whether the error can be mapped to a status code.


Copyright © 2012. All Rights Reserved.