Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-19 17:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found