Search in sources :

Example 1 with PerformException

use of android.support.test.espresso.PerformException in project appium-espresso-driver by appium.

the class SendKeys method handle.

@Override
@Nullable
public Void handle(TextParams params) throws AppiumException {
    String id = params.getElementId();
    ViewInteraction viewInteraction = Element.getById(id);
    // Convert the array of text to a String
    String[] textArray = params.getValue();
    StringBuilder stringBuilder = new StringBuilder();
    for (String text : textArray) {
        stringBuilder.append(text);
    }
    String textValue = stringBuilder.toString();
    try {
        viewInteraction.perform(typeText(textValue));
    } catch (PerformException e) {
        throw new AppiumException("Could not apply sendKeys to element " + id + ": " + e.getMessage());
    }
    return null;
}
Also used : AppiumException(io.appium.espressoserver.lib.handlers.exceptions.AppiumException) ViewInteraction(android.support.test.espresso.ViewInteraction) PerformException(android.support.test.espresso.PerformException) Nullable(javax.annotation.Nullable)

Aggregations

PerformException (android.support.test.espresso.PerformException)1 ViewInteraction (android.support.test.espresso.ViewInteraction)1 AppiumException (io.appium.espressoserver.lib.handlers.exceptions.AppiumException)1 Nullable (javax.annotation.Nullable)1