use of io.appium.espressoserver.lib.model.Element in project appium-espresso-driver by appium.
the class Finder method handle.
@Override
public Element handle(Locator locator) throws AppiumException {
try {
if (locator.getUsing() == null) {
throw new InvalidStrategyException("Locator strategy cannot be empty");
} else if (locator.getValue() == null) {
throw new MissingCommandsException("No locator provided");
}
// Test the selector
ViewInteraction matcher = findBy(locator.getUsing(), locator.getValue());
matcher.check(matches(isDisplayed()));
// If we have a match, return success
return new Element(matcher);
} catch (NoMatchingViewException e) {
throw new NoSuchElementException("Could not find element with strategy " + locator.getUsing() + " and selector " + locator.getValue());
}
}
Aggregations