Skip to content

WM: $mech->find_all_inputs (and $mech->find_all_submits) doesn't #118

@spazm

Description

@spazm

petda...@gmail.com reported on Nov 9, 2007

From http://rt.cpan.org/Ticket/Display.html?id=29317

Attached is an example of this failure. I was orginally using v1.20,
using $mech->inputs to try and find why a 'next' button couldn't be
found. Have now upgraded to 1.30 and added the $mech->find_all_inputs
(find_all_submits has the same fault), and it's failing to find all the
imputs/submits for this particular form.

If you look at the view source for the page I'm looking at
(http://vienna.yapceurope.org/ye2007/search), you'll see that there is
only one form, and that it terminates at the end of the page with a
further hidden field and a second submit button. On subsequent pages
there is another hidden field and a third submit button. Unfortunately
all the above functions failed to find any of the extra inputs/submits,
such that trying to submit the form with the named button fails.

I'm guessing that because there is other HTML code between the two, a
closing tag within that form also closes the form automatically, even
though it is still nested hasn't been closed.


#!/usr/bin/perl -w
use strict;

#############################################################################
#Library Modules #
#############################################################################

use WWW::Mechanize;

#############################################################################
#Global Variables #
#############################################################################

my $BASE = 'http://vienna.yapceurope.org/ye2007/search';

my $mech = WWW::Mechanize->new();
$mech->agent_alias( 'Linux Mozilla' );

#############################################################################
#Code Block #
#############################################################################

$mech->get( $BASE );

while($mech->success()) {
my @forms = $mech->forms;
for my $form (@forms) {
print STDERR "FORM: ".$form->attr( 'name' ).'/'.$form->attr( 'id' )."\n";
my @inputs = $form->inputs;
for my $input (@inputs) {
print STDERR " INPUT: ".$input->type().'/'.$input->name()."\n";
}
}

my @submits = $mech->find_all_submits();
for my $submit (@submits) {
print STDERR " INPUT: ".$submit->type().'/'.$submit->name()."\n";
}

$mech->click_button( name => 'next' );
}


 

Details

Imported from Google Code issue 14 via archive

Comments

petda...@gmail.com commented on Nov 13, 2007 :

(No comment was entered for this change.)
  • Summary : WM: $mech->find_all_inputs (and $mech->find_all_submits) doesn't

petda...@gmail.com commented on Apr 24, 2011 :

(No comment was entered for this change.)
  • Labels : WM

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions