2

I am using WebdriverIO and I want to scroll to an element.

But no matter if I'm using element.scroll() or browser.scroll(0,yLocation) it will always scroll to the top of the page.

Is it possible there is a problem if the page itself has some auto-scrolling?

The answer to this question helps for one of my elements which is at the bottom of the page, but I haven't been able to find a way to scroll to the element in the middle of the page.

  • Use answer from this question: sqa.stackexchange.com/questions/18796/… – Bharat Mane Sep 8 '17 at 10:05
  • 1
    @BharatMane why do you think this is a dup and that question has an answer? There are just the different ways to scroll to an element but that does not answer the question stated here. I would say this cannot be considered as a dup unless the question author add more details to the question. – Alexey R. Sep 8 '17 at 10:16
  • @AlexeyR. i dont know what more of details i could give you. – pwnh Sep 8 '17 at 10:43
  • @BharatMane that answer helps for 1 of my elements which is located at the bottom of the page, however the approach of scrolling to an element which is in the middle of the page does not work. – pwnh Sep 8 '17 at 10:44
  • I have edited the question to add information from the comments – Kate Paulk Sep 8 '17 at 11:47
2

We now have an API for this. See scroll into view

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.