Watir 6.0 Beta 4

Written by: Titus Fortner on September 12, 2016

Watir 6.0 Beta 4 is now available on rubygems! Watir 6.0 depends on Selenium 3.0, and it will have its production release once Selenium 3 is released. We’re continuing to update and simplify the code in the meantime. This release adds two new methods and removes two outdated feature toggles.

To install:

gem install watir --pre

or in your Gemfile:

gem "watir", ">= 6.0.0.beta4"

New Methods

Element#stale? - Returns true if a previously located element is no longer attached to DOM Element#wait_until_stale - Waits until an element has gone stale

Always Locate

The in depth details of the history and reasoning for this change are discussed in this Watirtight Testing post.

If you currently override the default settings and use Watir.always_locate = false, know that #exist? and #present? will no longer return false for stale elements. Please update your code to use #stale? and #wait_until_stale as appropriate.

Prefer CSS

At one point XPath was considered significantly slower (especially on Windows / IE) than CSS as a means of locating elements. Recent benchmarks in Windows, and our own Watirspecs on Linux have shown that this is no longer the case. The Watir#prefer_css toggle has been deprecated and all elements that can not be passed directly as Selenium locators will be translated to XPath.

If you currently override the default settings and use Watir.prefer_css = true, and have reason to believe that this is important for your situation, thanks to Alex’s recent work making element location extensible, you can use the new watir_css gem to obtain the same behavior.

See the Changelog for all of the updates.