I also add a debugging line after the $mech->select() line to print the value set for the field ("S. cerevisiae").my $f = 0; for my $form ($mech->forms) { printf "Find form #%d: %s\n", ++$f, $form->attr('name'); my $i = 0; for my $input ($form->inputs) { printf "Input #%d: %s (type: %s), values: [%s]\n", ++$i, $input->name, $input->type, join(', ', $input->possible_values); } }
print 'Selected species: ', $mech->value('species'), "\n";
When I run it, I got this result:
Somehow the 'species' field isn't found and an error is issued instead. There are 11 fields. I can't figure out why the 'species' field isn't recognized. I think there's something went along the way to the remote server. So I download the html code and put it on my local web server. What I get is even more suprising, increasing my curiosity level:Find form #1: paramForm Input #1: paramFile (type: hidden), values: [] Input #2: upstream (type: hidden), values: [] Input #3: runBeam (type: hidden), values: [] Input #4: runAmbiguizer (type: hidden), values: [] Input #5: runBipartites (type: hidden), values: [] Input #6: upstreamType (type: radio), values: [intergenic, fixed] Input #7: group (type: textarea), values: [] Input #8: groupFile (type: file), values: [] Input #9: emailAddress (type: text), values: [] Input #10: emailSubject (type: text), values: [] Input #11: selectParamsButton (type: submit), values: [] Input "species" not found at monkfan.pl line 31 No such field 'species' at /usr/lib/perl5/site_perl/5.8.8/WWW/Mechaniz +e.pm line 1324
Find form #1: paramForm Input #1: paramFile (type: hidden), values: [] Input #2: upstream (type: hidden), values: [] Input #3: runBeam (type: hidden), values: [] Input #4: runAmbiguizer (type: hidden), values: [] Input #5: runBipartites (type: hidden), values: [] Input #6: species (type: option), values: [init, A. fumigatus Af293, A +. gossypii, A. nidulans, A. thaliana, A. tumefaciens C58, B. subtilis +, C. elegans, C. tetani E88, C. trachomatis, Candida albicans, Candid +a glubrata, Candida lusitaniae, Candida tropicalis, Cryptococcus neof +ormans, D. melanogaster, D. rerio, E. coli K12-MG1655, Fusarium verti +cillioides, H. influenzae, H. pylori, H. sapiens, Histoplasma capsula +tum, Kluyveromyces lactis, M. jannaschii, M. tuberculosis CDC1551, M. + tuberculosis H37Rv, Magnaporthe grisea, N. crassa, Neurospora crassa +#2, P. aeruginosa PA01, P. falciparum 3D7, R. norvegicus, Rhizopus or +yzae, S. aureus MW2, S. cerevisiae, S. pombe, S. typhimurium LT2 SGSC +1412, V. cholerae El Tor N16961, Y. pestis CO92, Yarrowia lipolytica] Input #7: upstreamType (type: radio), values: [intergenic, fixed] Input #8: group (type: textarea), values: [] Input #9: groupFile (type: file), values: [] Input #10: emailAddress (type: text), values: [] Input #11: emailSubject (type: text), values: [] Input #12: selectParamsButton (type: submit), values: [] Selected species: S. cerevisiae
First, there are 12 fields. Second, the 'species' field is there at #6 (as type 'option') along with the possible values for the select. Third, the selected option is confirmed, and it's "S. cerevisiae".
Frankly, I haven't find anything why the difference. I'm not even sure whether this has something to do with the internal of WWW::Mechanize although I tend to think "no".
Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!
In reply to Re: Problem with WWW::Mechanize 'select' method
by naikonta
in thread Problem with WWW::Mechanize 'select' method
by monkfan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |