scroll to element only scrolls one screen
See original GitHub issuewhen using js.executeScript(“mobile: scroll”, scrollObject) instead of scrolling to element only one scroll is performed. If object is in the bottom and you need to scroll more than once to see it than scroll doesn’t get to the object.
Environment
- Appium version1.5.0
- Last Appium version that did not exhibit the issue 1.4.16
- Desktop OS/version used to run Appium:10.11.13
- Node.js version (unless using Appium.app|exe):v5.8.0
- Mobile platform/version under test:iOS
- Real device or emulator/simulator:Real devices iOS8/9
- Appium
Create a gist which is a paste of your full Appium logs, and link them here. Do not paste your full Appium logs here, as it will make this issue very long and hard to read! If you are reporting a bug, always include Appium logs!
Code To Reproduce Issue [ Good To Have ]
public void scrollToListItemElement(MobileElement scrollToElement, MobileElement optionalOverlappingElement) {
int initialHeight = scrollToElement.getCenter().getY();
JavascriptExecutor js = driver;
String webElementId = scrollToElement.getId();
HashMap<String, String> scrollObject = new HashMap<>();
scrollObject.put("element", webElementId);
scrollObject.put("direction", "down");
js.executeScript("mobile: scroll", scrollObject);
}
Please remember that, with sample code; it’s easier to reproduce bug and much faster to fix it.
Please git clone https://github.com/appium/sample-code and use one of your favourite languages and sample apps to reproduce issue.
In case a similar scenario is missing in sample-code, please submit a PR with one of the sample apps provided. Archive.zip
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
Scrolling to an element is no longer supported in Appium 1.5.
mobile: scroll
with an element scrolls on that element. That is why it does nothing when called again. Try usingmobile: scroll
without the element, checking if the element is visible and re-scrolling if not.This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.