How to scroll to an element out of the current screen?

Hello,

I’m working con SeleniumLibrary in a web where a need to go to a locator that is out of the current view. In the “real life” I use the mouse wheel to go down in the screen.

I’m trying to use the “Scroll element into view” but I get an error because the element is out of the bounds of the viewport.

Does anyone know how I “simulate” the scroll down of the mouse wheel or do something similar to move the screen to the desired locator?

Thank you in advance.

For some elements that are still off screen after scrolling to (usually a floating toolbar element for us) I have seen products using something like:

Execute Javascript    window.scrollTo(0, window.scrollY+height)

Height being the positive or negative pixel value you want to move by and ScrollY is the current Y position

1 Like

I’ll test it.

Thank you Brandon

Hi Brandon,

Your suggestion works fine. My problem is using that I scroll all the page but I need to scroll an small area inside the page. How can I scroll only that sub-window?

Thanks in advance.

@vgonzal You will probably have to do something like the responses here: python - How to scroll a particular element(see attached image) horizontally in robot framework? - Stack Overflow