Hi Monks,

I m trying to access a url using mechanize. The url redirects me to a secure login and i must authenticate myself to get in. I want to automate this login process but the login page is created using Javascript:

document.write("<table border=0 align=center width=100%>"); document.write("<tr>"); document.write("<th align=right id=\"lblUserID\">"); document.write(getUserIDText(bShowBD)); document.write("</th>"); //document.write("<td align=left><input type=\"text\" name=\"useri +d\" value=\"\" maxlength=\"128\" size=\"9\"></td>"); document.write("<td align=left><input type=\"text\" name=\"userid\ +" value=\"" + getUserName() + "\" maxlength=\"128\" size=\"9\"></td>" +); document.write("</tr>"); document.write("<tr>"); document.write("<td colspan=2>"); document.write("<input type=\"hidden\" name=\"username\" value=\"\ +" maxlength=\"128\" size=\"9\">"); document.write("</td>"); document.write("</tr>"); document.write("<tr>"); document.write("<th align=right><LABEL ID=lblPWD>Password:</LABEL> +</th>"); document.write("<td align=left><input type=\"password\" name=\"pas +sword\" value=\"\" maxlength=\"46\" size=\"20\">"); document.write("</td>"); document.write("</tr>"); document.write("<tr>"); document.write("<td colspan=2>"); document.write("<input type=\"hidden\" name=\"login-form-type\" va +lue=\"pwd\">"); document.write("</td>"); document.write("</tr>"); document.write("<tr>"); document.write("<td align=center colspan=2><input type=\"submit\" +name=\"btnSubmit\" value=\" OK \" onClick=\"if (setReqURL()==false) + return false; if (checkCookiesAtField(userid)) return true; else ret +urn false;\"></td>"); document.write("</tr>");

from whatever i have read this isn't possible.But isn't there some hack?

Thanks in Advance.

In reply to Automate WebLogin by libvenus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.