scrollToExact not working

I’m using appium version 1.4.16 with java-client 3.3.0.
I’m testing on a real device Note 4 (SM-N910V) running API 21, Android version 5.0.1.

When I get to the page I want to scroll on I issue the following: (my element is at the bottom of the page).

((AndroidDriver<?>) driver).scrollToExact(“MORTGAGE LOAN2”);

I get different scenarios.

  1. Almost all the time it scrolls down and up a couple of lines (about 3 times, sometimes less) then bombs.
  2. Sometimes it does option 1 then scrolls all the way to the bottom, then all the way back to the top then back down to the object. This is painful as the list is long. I would expect the behavior to stop once the string is in view.
  3. I’ve also seen it be successful and stop once it scrolls to the string in view. However option scenario 1 still occurs everytime where it scrolls up and down a couple times (couple lines) before starting to scroll down.

Below is the stack trace for an instance were option 1 bombed.

Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 66.199 sec <<< FAILURE! - in TestSuite
verifyAccountTotalsChangeWhenHidingCCLoan(com.xxx.xx.android.testarea.TestClass) Time elapsed: 20.054 sec <<< FAILURE!
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: 17.80 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: ‘2.48.2’, revision: ‘41bccdd10cf2c0560f637404c2d96164b67d9d67’, time: ‘2015-10-09 13:08:06’
System info: host: ‘xxxxx-MBP.domain’, ip: ‘192.xxxx.0.xx’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.11.2’, java.version: ‘1.8.0_65’
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{appPackage=com.xxxx.xxx.xxxx, networkConnectionEnabled=true, warnings={}, appWaitActivity=com.xxxxx.xxxx.app.LoginActivity, databaseEnabled=false, deviceName=Android, platform=LINUX, appActivity=com.xxxx.xxxx.app.MainActivity, desired={appPackage=com.xxxx.xxxx.xxx, appActivity=com.xxxxxx.xxxxx.app.MainActivity, autoLaunch=false, platformVersion=21, appWaitActivity=com.xxxxx.xxxx.app.LoginActivity, autoWebview=false, platformName=Android, deviceName=Android}, autoLaunch=false, platformVersion=21, webStorageEnabled=false, locationContextEnabled=false, browserName=Android, takesScreenshot=true, javascriptEnabled=true, autoWebview=false, platformName=Android}]
Session ID: 3bb257e0-857d-49a2-aa06-36e5fdbe7e58
*** Element info: {Using=-android uiautomator, value=new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().description(“MORTGAGE LOAN2”).instance(0));new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().text(“MORTGAGE LOAN2”).instance(0));}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:353)
at io.appium.java_client.android.AndroidDriver.findElementByAndroidUIAutomator(AndroidDriver.java:394)
at io.appium.java_client.android.AndroidDriver.scrollToExact(AndroidDriver.java:149)
at com.cri.fnbo.android.testarea.TestClass.verifyAccountTotalsChangeWhenHidingCCLoan(TestClass.java:94)

Any help would be appreciated.

Herb

File an issue on github

1 Like

Okay, I just submitted the issue.

1 Like