Watir 6.0 Released!

Written by: Titus Fortner on November 9, 2016

Watir 6.0 is now available on RubyGems! Watir 6.0 is entirely implemented with Selenium 3.0, and has several new features.

To install:

gem install watir

or in your Gemfile:

gem "watir", "~> 6.0.0"

See the Changelog for a complete list of updates.

Since Watir 6.0 Beta 5 there have been two significant additions.

Automatic Waits

A more thorough explanation surrounding the reasons for this change can be found on this Watirtight Testing post.

This feature helps synchronize test code with the website by making additional effort to type the things and click the things written in the tests. If your test times have increased significantly, take a look at the Watir 6 FAQ.

Updated Wait methods

#when_present is gone, and #wait_until and #wait_while have gotten more powerful.

You shouldn’t need #when_present, but if you do, you can use the new implementation of #wait_until_present, which returns the object being waited for to allow for use in chaining.

Here are some examples of the ways that the new #wait_until and #wait_while methods can be used:

element.wait_until(&:present?).text
element.wait_until(timeout: 5, &:present?).text
element.wait_until(message: Sorry, &:present?)
element.wait_while { |el| el.text == Foo }
element.wait_while { browser.title == Foo }

Tags: