how to click the Buttons in Forms

B

Ban Hoang

Hi ,

=20

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:

=20

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

=20

------

HTMl source: ( this is frame_bottom)

=20

<form name=3Dform_login method=3DPOST action=3Dindex.php target=3D_top>

<tr>

<td align=3Dleft><input name=3Demail type=3Dtext value=3D""
class=3Dfield size=3D15 maxlength=3D50></td>

<td align=3Dleft><font face=3Dverdana =
size=3D1>&nbsp;</font><input
name=3Dpassword type=3Dpassword value=3D"" class=3Dfield size=3D15
maxlength=3D50></td>

<td align=3Dleft><font face=3Dverdana =
size=3D1>&nbsp;</font><input
type=3Dsubmit value=3D":: Login &gt;" class=3Dbutton></td>

</tr>

</form>

=20

This is the error I got:

=20

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'

=20

1 tests, 0 assertions, 0 failures, 1 errors
 
P

Patrick Spence

Ban said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,212
Messages
2,571,101
Members
47,695
Latest member
KayleneBee

Latest Threads

Top