G
Guest
Trying to submit the second form, when there are two forms on the page both
called "submit" using www::Mechanize and Html::Form
the first form html is: <input type="submit" name="submit" value="Go" />
The second form's: <input type=submit name=submit value=" S E N D ">
#After filling in my login details with and getting positive checks for
username and password filled in:
#! /usr/bin/perl
use strict;
use warnings;
use WWW::Mechanize;
my $mech WWW::Mechanize->new();
$mech->get("http://localhost/login.cgi");
foreach($mech->forms()){
if (defined $_->find_input('username'))
$_->value('username',"username");
if($mech->success){print "Username filled in \n";}else{print " $! \n"}
$_->value('password',"password");
if($mech->success){print "password filled in \n";}else{print " $! \n"}
}
}
$mech->submit("submit"); #I have also tried $_->click("submit"); but all
submitted the first form and not the second
called "submit" using www::Mechanize and Html::Form
the first form html is: <input type="submit" name="submit" value="Go" />
The second form's: <input type=submit name=submit value=" S E N D ">
#After filling in my login details with and getting positive checks for
username and password filled in:
#! /usr/bin/perl
use strict;
use warnings;
use WWW::Mechanize;
my $mech WWW::Mechanize->new();
$mech->get("http://localhost/login.cgi");
foreach($mech->forms()){
if (defined $_->find_input('username'))
$_->value('username',"username");
if($mech->success){print "Username filled in \n";}else{print " $! \n"}
$_->value('password',"password");
if($mech->success){print "password filled in \n";}else{print " $! \n"}
}
}
$mech->submit("submit"); #I have also tried $_->click("submit"); but all
submitted the first form and not the second