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.

Scroll Element Into View does not always scroll element into view

See original GitHub issue

In this screen you can see a set or radio buttons, highlighted in red image When these buttons are in view (top screenshot) I can click on them fine. However if they are not visible, because they are below the banner (bottom screenshot, highlighted in blue) I can’t click on them because then I get an error like: “Element is not clickable at point (111, 700). Other element would receive the click”

I tried to solve this by using keyword scroll element into view. However in this case it doesn’t work. The keyword reports PASSED but the element is not scrolled into view and I still get the error.

My suspicion is that the problem is that the radio button I want to click is still behind the banner highlighted in blue, even after scroll element into view passes.

How do get this element to actually scroll into view?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
aaltatcommented, Apr 30, 2019

I can reproduce the problem, my test page is based on this: https://www.w3schools.com/css/tryit.asp?filename=trycss_navbar_horizontal_black_fixed2 The Scroll Element Into View keyword only scrolls the element to the edge of the browser window. If there is those floating type of elements, Selenium does not scroll the element enough to be in view. I can produce the problem also in pure Selenium code. Also problem can be reproduced with many browsers, like Chrome and Firefox. I feel that the problem in lies in the Selenium or in the browser driver implementation side. I raised an issue the Selenium issue tracker: https://github.com/SeleniumHQ/selenium/issues/7159

1reaction
aaltatcommented, Apr 17, 2020

Have you looked at the Selenium testability plugin, it should have a keyword for this which works on JavaScript.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Element.scrollIntoView() - Web APIs | MDN
The Element interface's scrollIntoView() method scrolls the element's ancestor containers such that the element on which scrollIntoView() is ...
Read more >
scrollIntoView() doesn't scroll anywhere - Stack Overflow
scrollIntoView only works if the element itself is outside the viewport + its parent is scrollable. In the block property, try specifying ...
Read more >
Scroll an element into the center of the viewport - Hidde's blog
Say your page displays a list of names and you want a certain person to be highlighted and scrolled into view. There's a...
Read more >
JavaScript scrollIntoView() Explained By Examples
In this tutorial, you'll learn how to scroll an element into the view using the JavaScript scrollIntoView() method.
Read more >
Scrolling Elements Into View - Matthias Ott
While this is by far the most reliable and resilient option to scroll an element into view, it is not always possible and...
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