in reply to Re^3: select fields and mechanize
in thread select fields and mechanize

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^5: select fields and mechanize
by ikegami (Patriarch) on Feb 11, 2010 at 09:55 UTC

    try version 1.34, and then 1.6

    I intend to, as soon as you provide something to try.

    It very easy

    It's been 8 hours since you said that. Did you run into some problems?

      Alright

      I do the following

      $gear_box = "Manual"; $mech->select("cargear", "$gear_box");

      so I select the manual option of a select field and my intention is to send the value 1 to the server.

      the html code for the select field is this

      <select name="cargear" id="cargear" class="form_widt h"> <option value='0' >All</option> <option value='2' >Automatic</option> <option value='4' >No gear</option> <option value='1' >Manual</option>

      So I whant to

      select the "Manual" and send the value '1' to the server.

      This happens in version 1.34 of Mechanize

      In version 1.60 hapens the folowing

      Selecting the "Manual" will send the value "Manual" to the server??

      Why is the diference? Is it samething that have changed or is it a bug? How can I do what i have done in version 1.34 in the newer version 1.60?

      Kvantum

        Thanks to the anonymous monk for his work. Unfortunately, I get cargear=1 too.

        WWW::Mechanize 1.60 LWP 5.831 HTML::Form 5.829

        At the moment, the only conclusion we can draw is still "there's a bug in the code the you didn't show us". Still waiting for a minimal, runnable snippet that demonstrates the problem. We can't help you if you don't give us the info we need to help you!

        That is not : a test; a bug report; a self-contained runnable program that demonstrates your problem. Ex
        #!/usr/bin/perl -- use strict; use warnings; use WWW::Mechanize 1.60; my $ua = WWW::Mechanize->new( autocheck => 1, ); #~ use URI::file; #~ $ua->get( URI::file->new( __FILE__ )->abs(URI::file->cwd) ); $ua->get( 'file:'.__FILE__); $ua->update_html( <<'HTML'); <html> <head> <title> </title> </head> <body> <form> <select name="cargear" id="cargear"> <option value='0' >All</option> <option value='2' >Automatic</option> <option value='4' >No gear</option> <option value='1' >Manual</option> </form> </body> </html> HTML print $ua->dump_all,"\n\n"; $ua->select("cargear", "Manual"); print $ua->dump_all,"\n\n"; $ua->submit; __END__ $ perl -MDevel::ModList mechanize.select.vd.pl GET file:mechanize.select.vd.pl cargear=0 (option) [*0/All|2/Automatic|4/No g +ear|1/Manual] GET file:mechanize.select.vd.pl cargear=1 (option) [:0/All|2/Automatic|4/No g +ear|*1/Manual] Error GETing file:mechanize.select.vd.pl?cargear=1: File `mechanize.se +lect.vd.pl?cargear=1' does not exist at mechanize.select.vd.pl line 3 +5 AutoLoader 5.70 Carp 1.11 Carp::Heavy Compress::Raw::Zlib 2.024 Compress::Zlib 2.024 Config Config_git.pl Config_heavy.pl Devel::ModList DynaLoader 1.10 Encode 2.39 Encode::Alias 2.12 Encode::Config 2.05 Encode::Encoding 2.05 Exporter 5.63 Exporter::Heavy 5.63 Fcntl 1.06 File::Basename 2.77 File::Glob 1.06 File::GlobMapper 1.000 File::Spec 3.31 File::Spec::Unix 3.3 File::Spec::Win32 3.3 FileHandle 2.02 HTML::Entities 3.64 HTML::Form 5.829 HTML::Parser 3.64 HTML::PullParser 3.57 HTML::Tagset 3.20 HTML::TokeParser 3.57 HTTP::Config 5.815 HTTP::Cookies 5.833 HTTP::Cookies::Netscape 5.832 HTTP::Date 5.831 HTTP::Headers 5.827 HTTP::Headers::Util 5.817 HTTP::Message 5.834 HTTP::Request 5.827 HTTP::Request::Common 5.824 HTTP::Response 5.824 HTTP::Status 5.817 IO 1.25 IO::Compress::Adapter::Deflate 2.024 IO::Compress::Base 2.024 IO::Compress::Base::Common 2.024 IO::Compress::Gzip 2.024 IO::Compress::Gzip::Constants 2.024 IO::Compress::RawDeflate 2.024 IO::Compress::Zlib::Extra 2.024 IO::File 1.14 IO::Handle 1.28 IO::Seekable 1.1 IO::Uncompress::Adapter::Inflate 2.024 IO::Uncompress::Base 2.024 IO::Uncompress::Gunzip 2.024 IO::Uncompress::RawInflate 2.024 LWP 5.834 LWP::MediaTypes 5.822 LWP::MemberMixin LWP::Protocol 5.829 LWP::Protocol::file LWP::UserAgent 5.834 List::Util 1.22 Scalar::Util 1.22 SelectSaver 1.02 Storable 2.21 Symbol 1.07 Time::Local 1.1901 URI 1.52 URI::Escape 3.29 URI::_generic URI::_query URI::file 4.20 URI::file::Base URI::file::Win32 WWW::Mechanize 1.60 XSLoader 0.10 base 2.14 bytes 1.03 constant 1.19 integer 1.00 overload 1.07 re 0.09 utf8 1.07 vars 1.01 warnings 1.06 warnings::register 1.01 $
        Obviously it works perfectly as advertised/expected for me :)
        Thanks for the help! My code is big, and most of it haven't anything to do with this. The html file if the same. I'll take a new aproach to the problem and I will post my problem if and when I find it. Thanks once more for your help. /Kvantum
Re^5: select fields and mechanize
by Anonymous Monk on Feb 11, 2010 at 02:12 UTC
    It very easy

    Then where is your code?