Watir-webdriver does not appear to be able to locate optgroup element's by 
their label attribute.

For the following html:

```html
   <select id="name_list">
      <optgroup label="env1">
          <option value="comp1">comp1 details</option>
      </optgroup>
      <optgroup label="env2">
          <option value="comp1">comp1 details</option>
      </optgroup> 
   </select>
```

The optgroup cannot be found by its label attribute:

```ruby
browser.optgroup(:label => 'env2').exists?
#=> false
```

I believe the problem is in the following 
[method](https://github.com/watir/watir-webdriver/blob/master/lib/watir-webdriver/locators/element_locator.rb#L273-L274)
 of the element locator:

```ruby
def should_use_label_element?
  @selector[:tag_name] != "option"
end
```

Since this method would return false for the optgroup, I believe that 
watir-webdriver is trying to match a label _element_ rather than the label 
_attribute_.

---
Reply to this email directly or view it on GitHub:
https://github.com/watir/watir-webdriver/issues/219
_______________________________________________
Wtr-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to