nl.praegus.fitnesse.slim.util.scroll.IosScrollHelper 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.MobileBy;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
import nl.praegus.fitnesse.slim.util.by.IOSBy;
import nl.praegus.fitnesse.slim.util.IosHelper;
/**
* Helper to deal with scrolling for iOS.
*/
public class IosScrollHelper extends ScrollHelper> {
public IosScrollHelper(IosHelper helper) {
super(helper);
setWaitAfterMoveDuration(null);
}
@Override
protected IOSElement findTopScrollable() {
return helper.findElement(MobileBy.iOSNsPredicateString("type=='XCUIElementTypeScrollView' AND visible==1]"));
}
@Override
protected IOSElement findScrollRefElement(IOSElement topScrollable) {
IOSElement result;
if (topScrollable == null || !topScrollable.isDisplayed()) {
result = helper.findElement(MobileBy.iOSClassChain("**/XCUIElementTypeScrollView[`visible == 1`]/**/XCUIElementTypeStaticText[`visible == 1`][1]"));
} else {
result = helper.findElement(topScrollable, new IOSBy.Predicate("type=='XCUIElementTypeStaticText' AND visible==1"));
}
return result;
}
}