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

nl.praegus.fitnesse.slim.util.scroll.AndroidScrollHelper 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.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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy