When locating the label for an element, the element's name attribute is being 
compared to the label's for attribute. The element's id attribute should be 
used.


Given the html:

````html
<label for="new_user_first_name" id="first_label">First name</label>
<input name="new_user_first_name" id="new_user_first_name" class="name" />
<label for="new_user_last_name" id="last_label">Last name</label>
<input name="something_else" id="new_user_last_name" class="name" />
````

The correct result when the input name that matches the id:

````ruby
p browser.text_field(:label => 'First name').exists?
#=> true
````

An unexpected result when the input name does not match the id:

````ruby
p browser.text_field(:label => 'Last name').exists?
#=> false
````


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

Reply via email to