Watir 6.5.0 is now available on RubyGems! We’ve added an exciting new locator feature.
or in your Gemfile:
Locate elements based on presence/absence of multiple classes
:class locator strategy has always been intended to work for a single class;
just like how Selenium works. Because of how Watir was implemented, though,
class value matching is done by string comparison with what is in the DOM.
This means that the class locator will match on multiple classes, but only if the
order is the same as what is in the DOM.
For instance, previously this:
would get located by:
but would not get located by:
Because this was unintended functionality,
String values of the
locator that include multiple classes will now receive a deprecation warning.
Support for multiple classes will now require using an
Be careful updating your locator code directly from a String to an Array. Order no longer matters so you might match on an element you don’t expect.
See the Changelog for the complete history of updates.