Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^6: use WWW::Mechanize or LWP to interface with WEB

by naikonta (Curate)
on Nov 16, 2007 at 10:19 UTC ( [id://651161]=note: print w/replies, xml ) Need Help??


in reply to Re^5: use WWW::Mechanize or LWP to interface with WEB
in thread use WWW::Mechanize or LWP to interface with WEB

$mech->form_number(0) is the first form,
$mech->form_number(1) is the second form,
and so on...
No, the doc says: Forms are indexed from 1, so the first form is number 1, not zero.

Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!

  • Comment on Re^6: use WWW::Mechanize or LWP to interface with WEB

Replies are listed 'Best First'.
Re^7: use WWW::Mechanize or LWP to interface with WEB
by learnperl (Acolyte) on Nov 16, 2007 at 18:22 UTC
    Thanks, I used
    form_number(2)
    I didn't get an error but as I mentioned before it doesn't do anything... as David mentioned I included the regex and I did
    print $mechObject->content;
    but it only gives me the html of the first page where I would like to see results based open the fields that I just filled..
    How can I accomplish this..
    my $url = 'http://www.ancestry.com/'; my $mechObject = WWW::Mechanize->new(); $mechObject->get($url); die "can't get page!" unless $mechObject->success && $mechObject->content =~ /Your First Name/i; die "can't find form!" unless $mechObject->form_number(2); my @values = ('first', 'last', [option => 'M']); die "couldn't fill out form!" unless $mechObject->set_visible(@values) == 3; $mechObject->submit; die "can't submit form!" unless $mechObject->success && $mechObject->content =~ /Your Last Name/i; print $mechObject->content;
    Thanks in advance..
    LearnPerl

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 09:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found