Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^4: Automate WebLogin

by libvenus (Sexton)
on Jan 26, 2011 at 14:04 UTC ( [id://884348]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Automate WebLogin
in thread Automate WebLogin

Thanks for you help! I read the documentation of both JE and SpiderMonkey. Gave JE a shot but i m unable to proceed. Here is the code that i wrote to test JE:

use strict; use warnings; use JE; use Data::Dumper; use File::Slurp; my $je = new JE; $je->html_mode(1); $je->eval(scalar read_file 'output.js'); my $return_val = $je->eval('start()') or die $@;

The file output.js has the content of the javascript webpage that i want to parse.When i run the above script the JE failes with the follwing error:

ReferenceError: The variable start has not been declared at line 1.

Thanks!

Replies are listed 'Best First'.
Re^5: Automate WebLogin
by marto (Cardinal) on Jan 26, 2011 at 14:12 UTC

    Your approach differs from any advice you've been given. JE is an alpha release, are you sure you want to continue to ignore the advice you've been give on tried and tested routes and use this?

        I'm not sure what part of my advice you have problems with. I try to make the steps clear, so please tell me what step I didn't explain thoroughly enough:

        Learn what your browser sends, then send that from Perl.

        This is meant to tell you to investigate what data your browser sends to the remote webserver when you click a button. The intention behind is that the remote webserver cannot know whether there is a browser or a Perl script at the other side, so as long as your Perl script sends the same data as a browser, it will never find out.

        For example, using the Live HTTP Headers extension.

        This sentence is to show you a tool that can do the above.

        Or learn Javascript and how it interacts with the HTML DOM, and what the click for a submit button does.

        This sentence is intended to show you the other, more static, approach to scraping. Read (and understand) the Javascript and what it does, and directly replicate that from Perl.

        Or just modify the code to find it out.

        This sentence is to show you a variation on the more static approach. By modifying the Javascript code, you can also maybe find out what it does and what purpose it has.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-24 11:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found