I am stomped by a simple click command for the following fragment
<TR>
<TD>
<P><INPUT TYPE="SUBMIT" NAME="Send" VALUE="SEND">
<INPUT TYPE="RESET" NAME="Clear" VALUE="Clear">
</TD>
</TR>
The following watir line does not seem to work
browser.button(:name=>'Send').click
I get
/.rvm/gems/ruby-1.9.3-p194/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/element.rb:365:in ``assert_exists': unable to locate element, using {:name=>"Send", :tag_name=>"button"} (Watir::Exception::UnknownObjectException)
have tried different combination of :name and :value.
I believe this problem is related to the case sensitivity problem described in Watir-Webdriver Issue 72. Basically because the button has TYPE="SUBMIT"
, it is not found since watir is looking for "submit" (note the case difference).
As a workaround, you can do:
#Using input type
browser.input(:name => 'Send').click
#Using css locator
browser.element(:css => 'input[type=submit][name=Send]').click
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With