Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Watir Submit :tag_name=>"button" not found

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.

like image 963
user1860288 Avatar asked Nov 03 '22 10:11

user1860288


1 Answers

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
like image 152
Justin Ko Avatar answered Dec 11 '22 01:12

Justin Ko