http://qs321.pair.com?node_id=1030813


in reply to Mechanizing around Javascript

There is no form #2 on your login page. I recommend you to rewrite your code like this:
$mech->get($url); my $usr = "asdf"; #marked out for post my $pw = "asdffgg"; $mech->submit_form ( with_fields => { login_name => $usr, user_password => $pw, }, );
Also there is no need to use follow_link with absolute URL just use get

Replies are listed 'Best First'.
Re^2: Mechanizing around Javascript
by PerlSufi (Friar) on Apr 26, 2013 at 14:21 UTC
    Thanks. I have used the get() to receive my page, but I am still having problems getting te file by clicking a button in a form named "searchForm". It doesn't recognize the form id
      Please show HTML code you have in your browser for this page (usually you can get it by pressing Ctrl+U).
        performing control+U on the page gives me:
        <script type="text/javascript" src="/POSecureURL/scripts/SecureURL.js" +></script> <html> <head> <TITLE>USPS PostalOne!</TITLE> <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript"> var front_door = true; var loggedin = 1; var ary_spawned_windows = new Array(); function refreshbottom() { parent.frames["portal_hidden"].location="hidden.cfm"; } function startup() { forceFrameToTop(); refreshbottom(); window.defaultStatus = "USPS PostalOne!"; } function forceFrameToTop(){ if ( window != top ){ top.location.href = location.href; } } </SCRIPT> </head> <FRAMESET ROWS="100%,*" FRAMEBORDER="0" BORDER="0" BORDER="0"> <FRAME SRC="https://www.uspspostalone.com/CIMweb/owner.do?group_na +me=Mailer&landing=Dashboard" NAME="portal_main" title="Main Applicati +on Frame for Postal1" SCROLLING="AUTO"> <FRAME SRC="hidden.cfm" NAME="portal_hidden" title="Hidden System +Frame for Postal1" SCROLLING="NO"> </FRAMESET> <BODY onload="startup();" bgcolor="FFFFFF"> </BODY> </html>