Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: screen scraping

by Anonymous Monk
on Jan 09, 2005 at 03:05 UTC ( #420624=note: print w/replies, xml ) Need Help??


in reply to screen scraping

Replies are listed 'Best First'.
Re^2: screen scraping
by garskoci (Novice) on Jan 09, 2005 at 17:10 UTC
    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 ');
      Anyone?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://420624]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2023-01-31 13:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?