Watir 7.1.0 is now available on RubyGems. This release re-works a few things related to scrolling.
or in your Gemfile:
This method attempts to determine whether the top of the element is positioned on the page within the browser viewport. It is of limited value for most testing purposes, but it is necessary to support other methods, and there wasn’t a good reason not to make it a public method.
This method attempts to determine if clicking an element will result in a click intercepted error before trying to actually click on the method. Previous behavior was to always scroll the element to the top of the page. For this release the element will only be scrolled if it is determined not to already be in the viewport, and if it is not, it will be scrolled to the bottom of the page to match the correct behavior for clicking an element according to the WebDriver specification.
Automatic Element Scrolling
Per the WebDriver specification, mouse movements when executing action chains are not supposed to scroll the page. If
an element is outside the page, it is supposed to raise a “move target out of bounds” error. For most methods that use
the actions chains (
has been scrolling the element to the center of the viewport before executing the actions. In this release, we’ve
:scroll_to parameter that allows you to automatically scroll to
:bottom instead of
Further, if you do not want Watir to scroll at all, you can pass in
nil as the argument.
In addition to the above-mentioned methods,
#click also uses action chains when provided modifiers (e.g.,
:command, etc.), but has not been getting automatically scrolled. As of this release
this method will also automatically scroll.
See the Changelog for the complete history of updates.