Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: WWW::Mechanize to Fill in Fields when no Form Defined

by Corion (Patriarch)
on Apr 01, 2011 at 20:38 UTC ( [id://896993]=note: print w/replies, xml ) Need Help??


in reply to WWW::Mechanize to Fill in Fields when no Form Defined

If there is no <form>, then it can't be submitted without Javascript. WWW::Mechanize does not handle Javascript.

See WWW::Scripter and/or Win32::IEAutomation or WWW::Mechanize::Firefox for alternatives that handle Javascript.

Replies are listed 'Best First'.
Re^2: WWW::Mechanize to Fill in Fields when no Form Defined
by cavac (Parson) on Apr 01, 2011 at 22:14 UTC

    If there is no <form>, then it can't be submitted without Javascript.

    That's technically not correct. It can't (shouldn't) be submitted by a browser, but there is no reason why you can't do it in Perl. You can view what's going on by using wireshark or something similar. Then, just take the response you captured, and communicate to the server directly using IO::Socket::IP. Just replay the communication with your changes.

    If you really want the missing <form> elements, hack your own proxy with HTTP::Proxy.

    If you need to "simulate" a full blown browser session, you could try WWW::Mechanize::Firefox. If you are desperate (or want to have some fun with Pay-per-click advertising), there are also the modules X11::GUITest and Win32::GuiTest.

      There is no need to go down to raw socket communication. After investigating what happens, you can create the appropriate form as HTML::Form object and use WWW::Mechanize to send the data from the form.

        Syncing expectations to reality ... done.

        Uhm, yeah, you're right.

        That's probably one of the side effects of developing your own webserver i guess. Sometimes i assume that talking HTTP is easy for everyone (and that HTML is something everyone unterstands anyway). A bit of reality check now and then seems like a good idea.

        Thanks.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-25 15:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found