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
+);">
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 ');
|