Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Problem with www::mechanize Select.

by Anonymous Monk
on Nov 25, 2012 at 16:23 UTC ( #1005503=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I am trying to do a $mech->select but it is giving me an error like "Input "search_form:country_id" not found". Actually the "search_form:country_id" is present in the source code. I can not find where the Issue really is. The $mech->submit is also not submitting! Can anyone pls suggest me where i am getting wrong. The code is provided below.

use strict; use WWW::Mechanize; my $url = "https://jobs3.netmedia1.com/cp/faces/job_search?null"; my $mech = WWW::Mechanize->new(); print "$url\n"; eval{ $mech->agent_alias('Mac Safari'); $mech->get($url); $mech->form_name('myForm'); $mech->select('search_form:category_ext_id','0'); $mech->field('search_form:continent_id','1'); my @values = ("25","49"); $mech->select('search_form:country_id',\@values); $mech->submit(); };

Thank you all.

Comment on Problem with www::mechanize Select.
Download Code
Re: Problem with www::mechanize Select.
by Anonymous Monk on Nov 25, 2012 at 16:32 UTC
    Basically WWW::Mechanize isn't WWW::Mechanize::Firefox, one supports javascript, while the other one doesn't, the FAQ details the rest

      Is there any javascript working on that page? Can you pls suggest any other way which we can get this happen with www:mechanize only ?(by $mech->post or something?)

Re: Problem with www::mechanize Select. (gzip)
by tye (Cardinal) on Nov 25, 2012 at 20:01 UTC

    Looks to me like the problem is that the web site is sending compressed results even when the request says that compressed results are not accepted. A quick search of WWW::Mechanize documentation turned up "We add a Referer header, as well as header to note that we can accept gzip encoded content, if Compress::Zlib is installed."

    So it looks like you can fix your problem by installing the Compress::Zlib module.

    - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1005503]
Approved by moritz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2014-12-29 04:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (184 votes), past polls