Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^2: screen scraping

by garskoci (Novice)
on Jan 09, 2005 at 17:10 UTC ( #420705=note: print w/replies, xml ) Need Help??

in reply to Re: screen scraping
in thread screen scraping

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=''; my $mech = WWW::Mechanize->new( utocheck => 1 ); $mech->credentials( '', '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?
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 ./ line 23 Can't call method "header" on an undefined value at /usr/lib/perl5/site_perl/5.8.3/WWW/ line 1763.
$mech->click_button('Apply ');

Replies are listed 'Best First'.
Re^3: screen scraping
by garskoci (Novice) on Jan 11, 2005 at 05:11 UTC

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2023-02-08 23:11 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (44 votes). Check out past polls.