It appears that the tabindex attribute is being treated as tab_index in 
watir-webdriver. This seems to cause two issues:
1) Element#tab_index will return nil when an element has the tabindex attribute
2) :tab_index cannot be used to successfully locate an element that has a 
tabindex attribute

For example, given the html:

```html
<input type="checkbox" value="1" tabindex="8">
```

I would expect the tab_index method to return "8". However, you get:

```ruby
browser.checkbox.tab_index
#=> nil

browser.checkbox.tabindex
#=> NoMethodError: undefined method `tabindex' for #<Watir::CheckBox:0x34e5598>
```

When the :tab_index is used in a locator, the xpath generated is looking for 
the tab-index attribute (seen when $DEBUG=true):

```ruby
b.checkbox(:tab_index => '8').exists?
#=> ...
#=> :xpath=>".//input[@tab-index='8' and 
translate(@type,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='checkbox']"
#=> ...
```

To my knowledge, html only supports the 'tabindex' attribute rather than the 
'tab_index' attribute (http://www.w3schools.com/tags/att_global_tabindex.asp).

Therefore, I had expected watir-webdriver to either:
A) Use tabindex (as a Element method and valid locator) or
B) Translate tab_index to tabindex

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

Reply via email to