scrollTo method doesn't work

In my iOS app, there is an element named ‘foo’ that is several pages down in a scrollable panel. When I call driver.scrollTo(“foo”) it fails with the following exception. But I am able to call driver.findElement(“foo”) and it does find that element. What am I doing wrong?

Appium version: 1.5.3
Java version: 1.8.0_92
iOS version: 9.3.2

Caused by: org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 15.29 seconds
For documentation on this error, please visit:
Build info: version: ‘2.53.0’, revision: ‘35ae25b’, time: ‘2016-03-15 17:00:58’
System info: host: ‘xxx’, ip: ‘’, ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.11.5’, java.version: ‘1.8.0_92’
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities [showIOSLog=true, recreateChromeDriverSessions=false, newCommandTimeout=3600, platformVersion=null, browserName=, platformName=iOS, udid=a0ed91fc4f6c5ee74f2b33b0b42fbf4fb1a837b3, version=null, deviceName=iPhone 6, fullReset=true, platform=iOS}, newCommandTimeout=3600, platformVersion=null, webStorageEnabled=false, locationContextEnabled=false, browserName=, takesScreenshot=true, javascriptEnabled=true, platformName=iOS, udid=a0ed91fc4f6c5ee74f2b33b0b42fbf4fb1a837b3}]
Session ID: 111047e1-e529-4b24-9d7f-27fea7bd30ab
*** Element info: {Using=-ios uiautomation, value=.scrollToElementWithPredicate(“name CONTAINS ‘foo’”)}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
at java.lang.reflect.Constructor.newInstance(
at org.openqa.selenium.remote.ErrorHandler.createThrowable(
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(
at org.openqa.selenium.remote.RemoteWebDriver.execute(
at io.appium.java_client.DefaultGenericMobileDriver.execute(
at io.appium.java_client.AppiumDriver.execute(
at io.appium.java_client.ios.IOSDriver.execute(
at org.openqa.selenium.remote.RemoteWebElement.execute(
at io.appium.java_client.DefaultGenericMobileElement.execute(
at io.appium.java_client.MobileElement.execute(
at io.appium.java_client.ios.IOSElement.execute(
at org.openqa.selenium.remote.RemoteWebElement.findElement(
at io.appium.java_client.ios.IOSElement.findElementByIosUIAutomation(
at io.appium.java_client.ios.IOSElement.scrollTo(
at io.appium.java_client.ios.IOSElement.scrollTo(
at io.appium.java_client.ios.IOSDriver.scrollTo(


As per readme provided for java client 4.0 version, scrollTo and scrollToExact are deprecated.

What is the new way to scroll to an element in iOS then?

you can use swipe method.
like ((MobileElement)element).swipe(SwipeDirection.UP,100);

Thank you. I was able to use driver.swipe method to finish my test.

I am trying to swipe using below code:
((IOSElement)element).swipe(SwipeElementDirection.DOWN,100 );

But I am getting java.lang.NullPointerException. Any help?


What if the element is not displayed on UI and it is presented at bottom of a list having more number of elements. Say, e.g. I’ve 200 contacts in our application. I need to scroll down up to the last 200th element based on String (text attribute value). How come this is possible?



Could anyone suggest about this scroll to alternative.!!

Vijay Bhaskar.

lets discuss & conclude in single thread If scrollTo is deprecated in java client 4.0, what is the alternative?