Dear monks, I am new in Perl and Mechanize. I want to read an Html page and follow the link. This page has a table with radio buttons, in a browser you tick one, and then click on an "Ok" button to see the chosen information.

The source page in html is as follow (printed using  print $mech->content() :

<tbody> <tr class="moduloTableauCouleur"> <td> <input type=radio name="%%RBGROUP16843009" value="wt_200 +0-selector[1]" ></td> </td> <td>0001887609&nbsp;</td> <td>&nbsp;</td> <td>010249X02&nbsp;</td> <td>Verif. código barra&nbsp;</td> <td align="right">52,00 &nbsp;</td> <td>ZRCB&nbsp;</td> <td>&nbsp;</td> </tr> <tr class="moduloTableauBlanc"> <td> <input type=radio name="%%RBGROUP16843009" value="wt_200 +0-selector[2]" ></td> </td> <td>0001891413&nbsp;</td> <td>&nbsp;</td> <td>010249X02&nbsp;</td> <td>Verif. código barra&nbsp;</td> <td align="right">52,00 &nbsp;</td> <td>ZRCB&nbsp;</td> <td>&nbsp;</td> </tr> <tr class="moduloTableauCouleur"> <td> <input type=radio name="%%RBGROUP16843009" value="wt_200 +0-selector[3]" ></td> </td> <td>0001891414&nbsp;</td> <td>&nbsp;</td> <td>010249X02&nbsp;</td> <td>Verif. código barra&nbsp;</td> <td align="right">30,00 &nbsp;</td> <td>ZRCB&nbsp;</td> <td>&nbsp;</td> </tr> </tbody>

I would like to select one of these radio buttons but I haven't succeeded. I have tried different ways:

$mech->tick( name => 'wt_2000-selector[3]', value => 'Select'); $mech->select( name => '%%RBGROUP16843009', value => 'wt_2000-selector +[3]'); $mech->submit_form( form_name=>'%%RBGROUP16843009',fields=>'wt_2000-se +lector[3]', button => 'Select');
but none has worked. Does anybody know how to do it? Thanks in advance. Yours faithfully, Josep Bonet

In reply to Select radio button 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.