All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.praegus.fitnesse.slim.util.scroll.IosScrollHelper Maven / Gradle / Ivy

There is a newer version: 0.0.22
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy