UiSelector iOS not finding Element Table or Even Scrolling

Tried multiple things to get a Table in iOS to scroll to an element off screen.

Here’s what I tried.:
Does not find the scrollable element

driver.findElement(MobileBy.IosUIAutomation(
                "new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().text(\"SomeName\"));"));

Element found but does not scroll

MobileElement element = (MobileElement) driver.findElementByXPath("//*[@label='SomeName']");
new TouchAction(driver).tap(new TapOptions().withElement(new ElementOption().withElement(element))).perform();

Seems the basic scrolling down does not work either. But almost exact same code used for swiping works perfect with only X,y values different.

startX = (size.width / 2); startY = (int) (size.height * 0.60); endY = (int) (size.height * 0.30);
action.press(p1.point(startX, startY))
                    .waitAction(waitOpt.withDuration(Duration.ofMillis(200)))
                    .moveTo(p1.point(startX, endY)).release().perform();

I’ve even tried with Java calling the Javascript, odd thing is that if I eliminate the line with the element the scrolling happens but just not to the element I want.

MobileElement element = (MobileElement) driver.findElementByXPath("//*[@label='SomeName']");
HashMap<String, String> scrollObject = new HashMap<String, String>();
scrollObject.put("direction", "down");
scrollObject.put("element", element.getId());  
driver.executeScript("mobile: scroll", scrollObject);

I’m at my wits end nothing on iOS seems to work all the time. Android on the other was super simple to make this work.

@John

  1. you mixing iOS and Android.
    https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable = UiScrollable used ONLY with Android
  2. with “mobile: scroll” try as in original. http://appium.io/docs/en/writing-running-appium/ios/ios-xctest-mobile-gestures/. Note that you should “getId” of element you trying to scroll not TO element. Also try to change direction from down -> up (sometimes it works funny)

So what is the equivalent of UiScrollable for iOS, since there is a MobileBy.IosUIAutomation? I’ve tried both the basic scrolling Up and Down nothing works

no equivalent. you can use either:

  1. executeScript with scroll or swipe
    or
  2. Touch actions (work faster then 1)