lstacey has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I am looking to become familiar with the WWW::Mechanize Module. I am trying to learn how to automate inputs in some fields but dont quite understand why I see different outputs with the following code at different uri....
#!/usr/bin/perl -w use WWW::Mechanize; use strict; my $mech = WWW::Mechanize->new(); $mech->get("https://www.google.com/"); #$mech->get("https://www.southwest.com/"); print $mech->uri(); print "\n"; my @theForms = $mech->forms(); print $#theForms."\n"; #How many forms are returned in the array foreach my $form (@theForms) { my @inputfields = $form->param; foreach my $input (@inputfields){ print $input."\n"; } }
When I navigate to google.com, I get this output listing the size of the form array and the fields within each form object
https://www.google.com/ 0 ie hl source biw bih q btnG btnI gbv
When I navigate to southwest.com, I get this output telling me there are no forms? Why might this be?
https://www.southwest.com/ -1
Thanks in advance!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WWW::Mechanize Forms...
by Corion (Patriarch) on Dec 14, 2015 at 22:26 UTC | |
by lstacey (Initiate) on Dec 15, 2015 at 03:20 UTC | |
by soonix (Chancellor) on Dec 15, 2015 at 11:27 UTC |