I am trying to scroll to an element using javascript executor on my Ruby script using selenium. However, the script scrolls all the way down of the page and skips the element. Thus not interacting with the element.
Scroll method:
def scroll_into_view(element, locator=nil)
element = element.nil? ? find(locator) : element
@wd.execute_script('arguments[0].scrollIntoView(true);', element)
end
Reference:
scroll_into_view(nil, gear_icon_span_locator)
Do you know of any other ways to scroll to an element in ruby?
I've tried action builders and actually moving to an element, that didn't seem to work.