Hi , I had written a code to integrate Mechanize module in my program. ...... ......... $agent->click('Button'); after this statement , it will load a html page containing five buttons having same name and different values. In that i would like to click on the 4th button... how can i do that? I wrote like this, but its failed (Getting server error...)
### Previous form submission $agent->click('Button'); #### End my $form = $agent->current_form; my $update = $form->find_input('FormButton','view',4); my $request = $update->click($form); $agent->{req} = $request; $agent->_do_request;
This is not working.... ----------------------------- This is my html code having more buttons with same name..
<html> <head> <title>Account</title> </head> <body bgcolor="#FFFFFF" text="#000000"> <form method="POST" action="abc.asp"> <div align="center"><center><table border="1" width="600" cellspacin +g="0" cellpadding="0"> <tr> <td width="100%"><table border="0" width="100%" cellspacing="0" +cellpadding="0"> <tr> <td width="100%" bgcolor="#000080"><font face="MS Sans Serif +" color="#FFFFFF"><small><strong>&nbsp; Account</strong></small></font></td> </tr> <tr> <td width="100%" bgcolor="#C0C0C0"><table border="0" width=" +100%" cellspacing="0" cellpadding="0"> <tr> <td width="57%"><font face="MS Sans Serif">&nbsp; <input + type="submit" value="Find" name="FormButton" style="font-family: MS Sans Serif">&nb +sp; <input type="text" name="SearchAccount" size="17" style="font-family: MS Sa +ns Serif"></font></td> <td width="43%"><div align="right"><p><font face="MS San +s Serif">&nbsp; <input type="submit" value="Apply" name="FormButton" style="fon +t-family: MS Sans Serif"> <input type="submit" value="Save" name="FormButton" style="font +-family: MS Sans Serif"> <input type="submit" value="View" name="FormButton" style="font +-family: MS Sans Serif"> <input type="submit" value="Close" name="FormButton" style="fon +t-family: MS Sans Serif">&nbsp;&nbsp; </font> </div> </td> </tr> </table> </td> </tr> <tr align="center"> <td width="100%" bgcolor="#C0C0C0"><table border="0" width=" +100%" cellspacing="0" cellpadding="0"> <tr> <td width="28%"><font face="MS Sans Serif">&nbsp; Sales +Reps</font></td> <td width="15%"><font face="MS Sans Serif"><input type=" +text" name="Sales_Rep" size="9" style="font-family: MS Sans Serif" value=""></font></td> <td width="15%"><font face="MS Sans Serif"><input type=" +text" name="Sales_Rep2" size="8" style="font-family: MS Sans Serif" value=""></font></td> <td width="17%"><font face="MS Sans Serif"><input type=" +text" name="Sales_Rep3" size="8" style="font-family: MS Sans Serif" value=""></font></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </div> </form> </body> </html>
Please post a solution. Regards

In reply to How can i recognize a button having same name by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.