in reply to Re: Automate WebLogin
in thread Automate WebLogin

Yeah that is what i thought(parsing the javascript and hardcoding values).But, how do i hardcode the click:

document.write("<td align=center colspan=2><input type=\"submit\" name +=\"btnSubmit\" value=\" OK \" onClick=\"if (setReqURL()==false) ret +urn false; if (checkCookiesAtField(userid)) return true; else return +false;\"></td>");
Thanks,

Replies are listed 'Best First'.
Re^3: Automate WebLogin
by Corion (Patriarch) on Jan 21, 2011 at 18:40 UTC

    Learn what your browser sends, then send that from Perl. For example, using the Live HTTP Headers extension. Or learn Javascript and how it interacts with the HTML DOM, and what the click for a submit button does. Or just modify the code to find it out.

      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!

        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?