See 
http://stackoverflow.com/questions/16574999/watir-webdriver-unable-to-identify-button-by-value
  for sample HTML and IRB results

Basically given HTML such as 

    <button type="button" class="btn fb-user-type" value="is_agent">An 
Agent</button>
    <button type="button" class="btn fb-user-type" value="is_grower">A 
Grower</button>

It is reasonable to expect that the following should work.  But it fails. 

    b.button(:value => "is_agent").exists?

Strangely enough, watir seems to actually know the value..  if I use 

    b.button(:name => "fb-user-type").value 

It will return "is_agent" as might be expected.

I believe this is because we use .button for both true button elements, and 
input elements of type button. For the input elements there is no such thing as 
included text, so the 'value' of the button is also the button text displayed 
for the user  So for an input of type button  value == text

However for a true button element, the included text and the value are two 
different things.  As for the buttons above, I can in fact select them, using 
:value, but only if I provide the included text "An Agent" as the 'value' to be 
matched.  (if I wanted to do that, I'd be using :text) which is, well, wrong.

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

Reply via email to