abualiga has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I'm a perl beginner and am learning to use the www::mechanize module to get a list of genome sequencing projects from http://www.ncbi.nlm.nih.gov/Traces/wgs/. After I fill in the form, I cannot figure out how to select 'All' from the 'Show projects on page' listbox.
I tried 'find_all_inputs' with 'select' as criteria for a listbox, but nothing gets assigned to the variable. My other issue is not being able to click on the 'Download as TAB delimited list' link to output results to file.
I can complete this task using the browser, but then I don't learn. Below are the few lines of code I have so far. Your advice will be a great help.
many thanks!
#!/usr/local/bin/perl use strict; use warnings; use autodie qw/ open close /; use 5.012; use WWW::Mechanize; # create WWW::Mechanize object # autocheck 1 checks each request to ensure it was successful my $browser = WWW::Mechanize->new( autocheck => [1] ); # retrieve page $browser->get( 'http://www.ncbi.nlm.nih.gov/Traces/wgs/' ); #select form to fill based on mech-dump output $browser->form_number(1); # fill field 'term' with name of species $browser->field( 'term', 'Escherichia' ); # click apply button $browser->submit( 'Apply' ); my $url = $browser->uri; # launch browser to test url #system( 'firefox', $url ); my @inputs = $browser->find_all_inputs( type => 'select' ); say @inputs;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: stuck with WWW::Mechanize drop down list
by spazm (Monk) on Jun 02, 2012 at 00:29 UTC | |
by spazm (Monk) on Jun 02, 2012 at 01:02 UTC | |
by abualiga (Scribe) on Jun 02, 2012 at 03:58 UTC | |
by spazm (Monk) on Jun 02, 2012 at 06:09 UTC | |
by abualiga (Scribe) on Jun 02, 2012 at 13:22 UTC |