Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 29317
Status: resolved
Priority: 0/
Queue: WWW-Mechanize

People
Owner: Nobody in particular
Requestors: BARBIE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.30
Fixed in: (no value)



Subject: $mech->find_all_inputs (and $mech->find_all_submits) doesn't :(
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.
Subject: crawler.pl
#!/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' ); }