Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: What's the easiest way to have perl fill in a web form & submit it?

by jdlev (Scribe)
on Feb 08, 2010 at 20:37 UTC ( [id://822081]=note: print w/replies, xml ) Need Help??


in reply to Re: What's the easiest way to have perl fill in a web form & submit it?
in thread What's the easiest way to have perl fill in a web form & submit it?

Thanks for the help! Mechanize looks like a great pm! I've hit a big snag I think. I can't get Mech to recognize the form. In the web page source code, there is no form name. They are using javascript to verify the data on the form for the login page. Perl can't find the form for whatever reason. So what are my options?

Also, what's an easy way to see if the program successfully made it past the login page and got to the next page?

I love it when a program comes together - jdhannibal
  • Comment on Re^2: What's the easiest way to have perl fill in a web form & submit it?

Replies are listed 'Best First'.
Re^3: What's the easiest way to have perl fill in a web form & submit it?
by kennethk (Abbot) on Feb 08, 2010 at 23:57 UTC
    If the web page in question relies heavily on JavaScript, then you can't directly use Mechanize as it doesn't include a JavaScript engine - see WWW::Mechanize::FAQ. There are a couple of alternatives available. You might be able to use Win32::IE::Mechanize or Mozilla::Mechanize, which are supposed to offer external control over your browser. I've never used either, though it seems Win32::IE::Mechanize is better developed and tested. A more roll-you-own solution would use JavaScript::SpiderMonkey, but that's getting pretty hairy. Another choice is if figuring out how the page processes your userid and password and just crafting your own query string - I'd probably take this approach.

    Determining success should be as simple as examining the content of the new page.

Re^3: What's the easiest way to have perl fill in a web form & submit it?
by Corion (Patriarch) on Feb 08, 2010 at 20:41 UTC

    Have you looked at the WWW::Mechanize documentation? It shows the ways you can get at the ->content of the page.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-19 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found