Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

WWW::Mechanize navigation

by abhipataskar42 (Initiate)
on Oct 18, 2012 at 06:33 UTC ( [id://999687]=perlquestion: print w/replies, xml ) Need Help??

abhipataskar42 has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to automate web navigation and need to fill a form that has a html text input with a default value

http://genome.ucsc.edu/cgi-bin/hgTables?command=start

this is website

<input type="TEXT" name="position" size="26" value="chr21:33031597-33041570" onfocus="setRadioCheck('hgta_regionType', 'range'); regionType='range'">

but i am unable to change the default value to the text input using set_fields()method.

My code

use WWW::Mechanize; my $mech = WWW::Mechanize->new(); $mech->agent('Mozilla/5.0'); $mech->proxy(['https', 'http', 'ftp'], 'http://202.41.70.84:6588'); open(DIR,"C:\\Users\\DELL\\Desktop\\Output\\outofBlat.txt") or die "Co +uldnt open"; open (FH1,">>C:\\Users\\DELL\\Desktop\\outoftables.html"); my@x=<DIR>; $num=1; $input="chr21:36259390-36260987"; $url="http://genome.ucsc.edu/cgi-bin/hgTables?hgsid=304457625"; $mech->get($url); die $mech ->res->status_line unless $mech ->success ; #+ML::Form $form = $mech->form_name("mainForm"); foreach my $inputfield (@inputfields) { if ($inputfield=~/posi +tion/) { $mech->set_fields($inp +utfield=>$input); } } $mech->submit; die $mech ->res->status_line unless $mech ->success ; # If the form sends you somewhere, you can catch it : my $new_url = $mech ->response->request->uri->as_string ; $html= $mech->content; print $html; print FH1 $html;

help me plz ...URGENT

Replies are listed 'Best First'.
Re: WWW::Mechanize navigation
by Anonymous Monk on Oct 18, 2012 at 06:41 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-26 00:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found