nl.praegus.fitnesse.slim.util.element.DummyContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of toolchain-appium-fixtures Show documentation
Show all versions of toolchain-appium-fixtures Show documentation
Fixtures to assist in android, iOS and windows app testing via FitNesse
package nl.praegus.fitnesse.slim.util.element;
import org.openqa.selenium.By;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.WebElement;
import java.util.List;
import static java.util.Collections.emptyList;
/**
* Normal 'setFoundBy' logic in RemoteWebDriver calls toString() on SearchContext. For AppiumDriver and its subclasses
* that means 2 remote calls getting all session details.
* This context can be used instead as 'foundBy-provider' which just returns a String without any remote calls needed.
*/
public class DummyContext implements SearchContext {
private final String displayName;
DummyContext(String displayName) {
this.displayName = displayName;
}
@Override
public List findElements(By by) {
return emptyList();
}
@Override
public T findElement(By by) {
return null;
}
@Override
public String toString() {
return displayName;
}
}