submitting a form when two forms with the same name

  • Follow


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 


0
Reply nospam21 (11322) 2/3/2008 3:54:50 AM

Quoth "Nospam" <nospam@nospam.com>:
> 
> 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  ">

Try

    $mech->click_button(value => '  S  E  N  D  ');

Ben

0
Reply Ben 2/3/2008 5:13:24 PM


1 Replies
32 Views

(page loaded in 0.059 seconds)

Similiar Articles:













7/10/2012 7:32:56 AM


Reply: