nl.praegus.fitnesse.slim.util.scroll.AndroidScrollHelper 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.scroll;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import nl.praegus.fitnesse.slim.util.AndroidHelper;
import org.openqa.selenium.By;
/**
* Helper to deal with scrolling for Android.
*/
public class AndroidScrollHelper extends ScrollHelper> {
public AndroidScrollHelper(AndroidHelper helper) {
super(helper);
}
@Override
protected AndroidElement findTopScrollable() {
return helper.findByXPath("(.//*[@scrollable='true'])[1]");
}
@Override
protected AndroidElement findScrollRefElement(AndroidElement topScrollable) {
AndroidElement result;
if (topScrollable == null || !topScrollable.isDisplayed()) {
result = helper.findByXPath("(.//*[@scrollable='true']//*[@clickable='true'])[1]");
} else {
result = helper.findElement(topScrollable, By.xpath("(.//*[@clickable='true'])[1]"));
}
return result;
}
}