Skip to content

Instantly share code, notes, and snippets.

@zevnull
Created April 11, 2014 13:20
Show Gist options
  • Save zevnull/10468282 to your computer and use it in GitHub Desktop.
Save zevnull/10468282 to your computer and use it in GitHub Desktop.
HashMap<String, String> scrollObject = new HashMap<String, String>();
//Must be an element with scrollable property; Android (ListView,ScrollabeView) IOS (UIAScrollableView
RemoteWebElement element = (RemoteWebElement) driver.findElement(By.[id/name/etc](scrollableElement));
JavascriptExecutor js = (JavascriptExecutor) driver;
String widId = ((RemoteWebElement) element).getId();
//Text for search on the screen
scrollObject.put("text", text);
scrollObject.put("element", widId);
js.executeScript("mobile: scrollTo", scrollObject);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment