List of usage examples for org.openqa.selenium.remote ErrorCodes NO_SUCH_ELEMENT
int NO_SUCH_ELEMENT
To view the source code for org.openqa.selenium.remote ErrorCodes NO_SUCH_ELEMENT.
Click Source Link
From source file:sandeep.kb.android.remote.android.AndroidWebDriver.java
License:Apache License
private void throwIfError(final JSONObject jsonObject) { int status;// w w w. jav a 2 s . co m String errorMsg; try { status = (Integer) jsonObject.get(STATUS); errorMsg = String.valueOf(jsonObject.get(VALUE)); } catch (JSONException e) { throw new RuntimeException("Failed to parse JSON Object: " + jsonObject, e); } switch (status) { case ErrorCodes.SUCCESS: return; case ErrorCodes.NO_SUCH_ELEMENT: throw new NoSuchElementException("Could not find " + "WebElement."); case ErrorCodes.STALE_ELEMENT_REFERENCE: throw new StaleElementReferenceException("WebElement is stale."); default: if (jsonObject.toString() .contains("Result of expression 'd.evaluate' [undefined] is" + " not a function.")) { throw new WebDriverException("You are using a version of Android WebDriver APK" + " compatible with ICS SDKs or more recent SDKs. For more info take a look at" + " http://code.google.com/p/selenium/wiki/AndroidDriver#Supported_Platforms. Error:" + " " + jsonObject.toString()); } throw new WebDriverException("Error: " + errorMsg); } }