Watir 6.13

Written by: Titus Fortner on September 2, 2018

Watir 6.13 is now available on RubyGems. Improved Watir wait syntax, and a few minor fixes.

To install:

gem install watir

or in your Gemfile:

gem "watir", "~> 6.13"

Wait for Element Attribute Values

To wait for an attribute value, you used to need to write:

element.wait_until { |el| el.text == 'Foo' }

Now you can do the same thing without a block:

element.wait_until(text: 'Foo')

You can use Regular expressions and/or use more than one attribute value:

element.wait_until(text: /Fo/, style: 'block')

This can still be mixed and matched with timeout and message values:

element.wait_until(message: 'Oops', text: 'Foo', timeout: 4)

Additional Items

  • It used to be that when an element collection was located, the elements would be cached and previously located elements would be tried before re-locating them. In the process of making collections lazy loaded, we broke this feature. There should be a minor performance improvement for anyone making extensive use of collections.

  • Watir now supports custom element tag names with Adjacent locators.

browser.div(id: "regular_child").parent(tag_name: :grandelement)
  • Watir now supports #set and #clear on elements with user-editable attribute. This should make some WYSIWYG implementations easier to interact with.

  • Improved support for Watigiri

See the Changelog for the complete history of updates.

Tags:

Thoughts about this article? Let us know!