Hello again. Well, I got a bit further. I'm actually trying to check a checkbox, not a radiobutton as I previously stated. I can log in, get the html from the page. When I try to check the checkbox, I don't receive any errors, but it's not working either. Here is my script.
#!/usr/bin/perl use strict; use warnings; use WWW::Mechanize; my $url='http://192.168.0.1/WanService.html'; my $mech = WWW::Mechanize->new( utocheck => 1 ); $mech->credentials( '192.168.0.1:80', 'FVS318', 'admin' => 'secret' ); # And then $mech->get() the same as in the LWP::UserAgent code my $response = $mech->get($url); die "Error at $url\n ", $response->status_line, "\n Aborting" unless $ +response->is_success; print "SUCCESS data type: ", $response->content_type, "\n\n"; #print "\n\n"; #print $response->content; $mech->tick('EnBt3', 'checkbox', 'CHECKED'); $mech->submit(); print "\n\nDone.\n\n";
Here is the html that I think I should be working with.
This one appears to be checked.
<td width="10%" align="center"><input type="checkbox" name="EnBt0" val +ue="checkbox" CHECKED > </td>
This one appears not to be checked and is the one that I'm trying to check.
<td width="10%" align="center"><input type="checkbox" name="EnBt3" val +ue="checkbox" ></td>

Am I doing something wrong?
Thanks.
I just wanted to add the html for the "Apply" button.
<input type="button" value="Apply " onClick="toApply(document.Wanblock +);">&nbsp;&nbsp;

I know that I'm very close. I tried to use to click the Apply button, but it produces the following error.
Unknown click_button parameter "Apply" at ./pm_test.pl line 23 Can't call method "header" on an undefined value at /usr/lib/perl5/site_perl/5.8.3/WWW/Mechanize.pm line 1763.
$mech->click_button('Apply ');

In reply to Re^2: screen scraping by garskoci
in thread screen scraping by garskoci

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.