0

Using watir-webdriver with Selenium I have element selectors with duplicate key warnings like

browser.div(class: 'one-possible-class', class: 'another-possible-class')

This works perfectly to resolve to elements that match either one or both of the given classes. The problem is that newer versions of Ruby (2.2 and up) throw warnings like this when different values are passed in using the same key.

warning: duplicated key at line 16 ignored: :class

So I tried using a regex

browser.div(class: /one-possible-class|another-possible-class/)

However, this did not work the same.

emery
  • 8,603
  • 10
  • 44
  • 51
  • 2
    What was different with the regular expression results? – titusfortner Sep 30 '15 at 21:04
  • 3
    Are you sure your original code worked as expected? When I tried with Ruby 1.9.3 and Watir-Webdriver v0.8.0, it only returned elements who had the "another-possible-class" class. It did not return those with just the "one-possible-class". – Justin Ko Sep 30 '15 at 21:11
  • Justin Ko, you are correct. I had assumed it was using a syntax that I read is valid where you can pass two element selectors and it matches elements that fit to either or both selectors, but in this case, it ignores the first selector, so my question is invalid. – emery Oct 02 '15 at 20:47

0 Answers0