Is there any alternative for ScrollTo() and ScrollToExact()

Is there any alternative for ScrollTo() and ScrollToExact()

e.g. Android:

   // by ID
    @AndroidFindBy(uiAutomator = "new UiScrollable(new UiSelector()).scrollIntoView("
            + "new UiSelector().resourceIdMatches(\".*id/publicity\"))")
    private List<AndroidElement> allowFriendsToSeeMe;
   // by Text
    public boolean tapMenuByText(String menuText) {
        System.out.println("  tap menu by text: "+menuText);
        try {
            return tapElement(driver.findElement(MobileBy
                    .AndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView("
                            + "new UiSelector().text(\""+menuText+"\"));")));
        } catch (Exception e) {
            return false;
1 Like


TouchActions classes

Any for iOS? really getting stuck with this missing in 1.0.0

@vijay.alapati you are lucky today for iOS:

public boolean tapItemByDescription(String text) {
        System.out.println("   tapItemByDescription(): " + text);

        // scroll to object
        JavascriptExecutor js = (JavascriptExecutor) driver;
        HashMap scrollObject = new HashMap<>();
        scrollObject.put("predicateString", "value == '" + text + "'");
        js.executeScript("mobile: scroll", scrollObject);

       // tap object
        WebElement el = ((IOSDriver) driver).findElementByIosNsPredicate("value = '" + text + "'");
        return tapElement((MobileElement) el); //tapElement just custom implementation. you may choose any way.

// example of some other predicate string which we can use in above example:
    @iOSXCUITFindBy(iOSNsPredicate = "type == 'XCUIElementTypeStaticText' AND name == 'Change profile name'")
    private List<IOSElement> changeProfileNameDialogHeader;

Swipe by co ordinates also work

What is tapElement? Is it some custom method in your framework

Also what is tapElement? looks custom method in your framework

@vijay.alapati @mathewkuruvila “tapElement” just custom function to maintain taps. There are 4 or even more ways to execute TAP with Appium. To make life easier to support i just do all taps through one function where i can easily change the way of tap and see how it is working in general across all screens.

Thank you @Aleksei
Is there any native method, like the UiScrollable for scroll in IOS. And also isn’t the element location strategy using predicate deprecated in latest appium after migration to xcuitest

@mathewkuruvila i gave you scrollable for iOS which is very similar to Android. “predicateString” supports with latest iOS and Appium - no problem. just try and enjoy.

Thank you. I will try it out :slight_smile:

I tried it out and it is not working for me. Starting another thread as i don’t want to hijack this thread. It will be great if you can look into this thread