Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

WWW::Mechanize navigation

by abhipataskar42 (Initiate)
on Oct 18, 2012 at 06:33 UTC ( #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

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'], ''); 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=""; $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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://999687]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2017-03-28 05:13 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (327 votes). Check out past polls.