Reputation: 45
Just got an unknown error when I try to scroll.to
a specific element. For example with:
@browser.scroll.to page_element_xy
#=> "Don't know how to scroll to: #< Watir::Div:0x... >! (ArgumentError)"
The normal scroll.to
:top
/ :bottom
is still working somehow.
Is just the DIV the problem or has the scroll.to
function changed in general?
On search, I found the following that worked for me:
page_element_xy.scroll.to :center
Would be nice to know what is recommended for now.
Upvotes: 4
Views: 1042
Reputation: 46826
As of Watir-Scroll v0.2, the browser-level scrolling no longer supports scrolling to an element.
The equivalent of:
@browser.scroll.to page_element_xy
Is now:
page_element_xy.scroll.to :top
Scrolling to the top of the element is the default, so you can simply do:
page_element_xy.scroll.to
Upvotes: 5