isVisibleWithinViewport() doesn't work on elements if viewport position is determined by element ID in URL #1758

Open
elewandowski opened this Issue Dec 8, 2016 · 0 comments

Projects

None yet

2 participants

@elewandowski

The problem

The method isVisibleWithinViewport does not seem to work on elements, if the page is scrolled to the element by an element ID at the end of the URL.

i.e.

  1. I have a webpage at website.com
  2. My viewport is 100x100
  3. I have an element with ID #HEADER, which is at position (0, 200)
  4. I go to website.com#header
  5. The webpage scrolls down so the page is at (0, 200)
  6. I query my #HEADER element with isVisibleWithinViewport() and the method returns false

If I do the above but, instead of step 4, I scroll down using scroll('#HEADER') method (so the object is in view), and then call isVisibleWithinViewport(), it returns true.

Because of this, I presume there is some viewport variable in Selenium that is not updated when a page is moved to the location of an element, which is specified by an ID at the end of the URL.

Environment

  • WebdriverIO version: 3.10.3
  • Node.js version: 6.4.0
  • Standalone mode
  • list of all wdio packages used: webdriverio@4.4.0, wdio-selenium-standalone-service@0.0.5, wdio-phantomjs-service@0.1.0, wdio-cucumber-reporter@0.0.2, wdio-cucumber-framework@0.2.12

Link to Selenium/WebdriverIO logs

https://gist.github.com/elewandowski/c3753d154ed3794d2c1390ebc51b2cb1

Code To Reproduce Issue [ Good To Have ]

I can provide sample code if necessary, but I would have to edit what I have so it's shareable.

@christian-bromann christian-bromann added this to the Upcoming milestone Dec 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment