Example usage for org.openqa.selenium InvalidElementStateException InvalidElementStateException

List of usage examples for org.openqa.selenium InvalidElementStateException InvalidElementStateException

Introduction

In this page you can find the example usage for org.openqa.selenium InvalidElementStateException InvalidElementStateException.

Prototype

public InvalidElementStateException(Throwable cause) 

Source Link

Usage

From source file:com.opera.core.systems.OperaWebElement.java

License:Apache License

private void assertElementEnabled(String message) {
    if (OperaFlags.ENABLE_CHECKS) {
        if (!isEnabled()) {
            throw new InvalidElementStateException(message);
        }/*  w  w w .  j a  v  a  2  s.  c  om*/
    }
}

From source file:sandeep.kb.android.remote.android.AndroidWebElement.java

License:Apache License

public void sendKeys(final CharSequence[] value) {
    if (value == null || value.length == 0) {
        return;/*w  w w. j  a v a2 s  . c o m*/
    }
    if (!isEnabled()) {
        throw new InvalidElementStateException("Cannot send keys to disabled element.");
    }
    // focus on the element
    this.click();
    driver.waitUntilEditAreaHasFocus();
    AndroidWebDriver.sleepQuietly(100);
    // Move the cursor to the end of the test input.
    // The trick is to set the value after the cursor
    driver.executeScript("arguments[0].focus();arguments[0].value=arguments[0].value;", this);
    AdbHelper.sendKeysViaAdb(driver.getDeviceId(), value[0]);
}