[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

how to click the Buttons in Forms

Ban Hoang

9/11/2006 6:02:00 PM


Hi ,



I try to write the code to click the button in form but it keep give me
errors. Any one have any idea how to make it work? Thanks!

----

Below is the code:



$ie.frame("bottom").button(:value, ":: Login >").click



------

HTMl source: ( this is frame_bottom)



<form name=form_login method=POST action=index.php target=_top>

<tr>

<td align=left><input name=email type=text value=""
class=field size=15 maxlength=50></td>

<td align=left><font face=verdana size=1>&nbsp;</font><input
name=password type=password value="" class=field size=15
maxlength=50></td>

<td align=left><font face=verdana size=1>&nbsp;</font><input
type=submit value=":: Login &gt;" class=button></td>

</tr>

</form>



This is the error I got:



1) Error:

test_01_LoginTestCase(TC_pulldownBox_Links_Clicks):

Watir::Exception::UnknownObjectException: Unable to locate object, using
value and :: Login &gt;

c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1928:in `assert_exists'

c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2009:in `click'

Login_test1.rb:25:in `test_01_LoginTestCase'



1 tests, 0 assertions, 0 failures, 1 errors

>Exit code: 1



1 Answer

Patrick Spence

9/11/2006 7:36:00 PM

0

Ban Hoang wrote:
> Hi ,
> $ie.frame("bottom").button(:value, ":: Login &gt;").click
> HTMl source: ( this is frame_bottom)
>
> <form name=form_login method=POST action=index.php target=_top>
>
> <tr>
>
> <td align=left><input name=email type=text value=""
> class=field size=15 maxlength=50></td>
>
> <td align=left><font face=verdana size=1>&nbsp;</font><input
> name=password type=password value="" class=field size=15
> maxlength=50></td>
>
> <td align=left><font face=verdana size=1>&nbsp;</font><input
> type=submit value=":: Login &gt;" class=button></td>
>
> </tr>
>
> </form>
>
> 1) Error:
>
> test_01_LoginTestCase(TC_pulldownBox_Links_Clicks):
>
> Watir::Exception::UnknownObjectException: Unable to locate object, using
> value and :: Login &gt;
>
> c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1928:in `assert_exists'
>
> c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2009:in `click'
>
> Login_test1.rb:25:in `test_01_LoginTestCase'
>

Just for S&G, try...

$ie.frame("bottom").button(:value, /Login/).click

Better yet, just call the .submit() method of the form itself.

--
Posted via http://www.ruby-....