Safari - iOS .getCoordinates().onPage() is acting like .getCoordinates().inViewport()
See original GitHub issueThe problem
I have a test that clicks a button which scrolls the page down to a particular section. I then assert that the heading is within the browser’s viewport. On iOS .getCoordinates().onPage() is acting like .getCoordinates().inViewport().
Environment
- Appium version: 1.53
- Desktop OS/version used to run Appium: OS X 10.11.6
- Mobile platform/version under test: iOS 9.3.5
- Real device or emulator/simulator: iPhone 4S
- Appium.app
Details
My problem is when the following line executes on Appium with iOS:
long headingHeight = element(By.cssSelector("h3#objective")).getCoordinates().onPage().getY();
On iOS the figure returned is 0 (which would be correct if I was asking for .getCoordinates().inViewport().getY();
) Executing the same test on Android returns the correct result.
This is a web test for the mobile web, not a web view or native app.
Code To Reproduce Issue
driver.get("http://appium.io/slate/en/master/?java#");
wait.until(ExpectedConditions.presenceOfElementLocated(By.linkText("Appium GUI"))).click();
Locatable heading = (Locatable) driver.findElement(By.cssSelector("#section-appium-gui>h1"));
System.out.println(heading.getCoordinates().onPage().getY());
For this example, on Android, the position is returned in the hundreds of thousands (which is correct , as you have to scroll pretty far to get here). On iOS, the response is -2 (which would be reasonable accurate if I was asking for onScreen or inViewPort.
Appium Logs
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
@hazmeister can you include a link to a gist of your appium log output?
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.