question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Safari - iOS .getCoordinates().onPage() is acting like .getCoordinates().inViewport()

See original GitHub issue

The 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());

Clone here

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

Gist

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jlippscommented, Sep 2, 2016

@hazmeister can you include a link to a gist of your appium log output?

0reactions
lock[bot]commented, Apr 26, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Geographic Locations - Apple Developer
Getting Geographic Locations. Use the JavaScript classes described in this chapter to obtain or track the current geographic location of the ...
Read more >
org.openqa.selenium.interactions.internal.Coordinates ...
Coordinates.inViewPort (Showing top 20 results out of 315) ... getCoordinates(); coordinate.onPage(); ... inViewPort(); optionToSelect.click(); webDriver().
Read more >
Get current position of the viewport in Mobile (iPhone) Safari
I'm trying to position a div in the center of the iphone viewport. Basically so that when you hit an image, it pops...
Read more >
HtmlUnitWebElement (htmlunit-driver 2.49.0 API) - Selenium
protected void, assertElementNotStale() ... Coordinates, getCoordinates() ... Specified by: inViewPort in interface org.openqa.selenium.interactions.
Read more >
Browse Pseudo-element Answers - Code Matcher
XML attribute vs XML element · How to set caret(cursor) position in contenteditable element (div)? · CSS negation pseudo-class :not() for parent/ancestor ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found