I'm trying to use WWW:Mechanize to no avail. I don't think it's working because it isn't a form that's submitting (at least I don't think it is...I'm not familiar with how to submit javascript forms?)

Here's the html for information I'm trying to submit and login with:

<tbody> <tr> <td colspan="2" id="login +Error" class="loginErrorText" align="center"> </td> </tr> <tr> <td width="37%" align="ri +ght" class="loginText"> Email: </td> <td width="50%" align="le +ft" class="loginTextInput"> <input type="text" id= +"txtUserName" name="email" style="width:150px;"/> </td> </tr> <tr> <td align="right" class=" +loginText"> Password: </td> <td align="left" class="l +oginTextInput"> <input id="txtPassword +" type="password" style="width:150px;"/> </td> </tr> <tr> <td class="login-text" al +ign="right"> Remember Me <input type="checkbox" + id="ckRememberMe" name="ckRememberMe" value="Remember Me"/> <div id="remember-me"> <a href="http://www +.draftstreet.com/ForgotPassword.aspx" class="login-text-remember"> Forgot Password? </a> </div> </td> <td align="right" style=" +padding-right:23px;padding-top:10px;"> <a href="javascript:vo +id(0);" id="btnSubmit"> <img src="http://23 +404f625988819b4d55-1a66a67fd18c432b98277c46ef65a97e.r10.cf1.rackcdn.c +om/button_signin.png" alt="Submit" border="0"/> </a> </td> </tr> <tr style="height:20px;"> <td colspan="2"> </td> </tr> </tbody>

And here's my script:

use WWW::Mechanize; print "Enter User ID: "; $username = <>; print "Enter Password: "; $password = <>; my $mech = WWW::Mechanize->new(); $url = "http://www.draftstreet.com/default.aspx"; print $url; $mech->get( $url ); $mech->field(txtUserName,$username); $mech->field(txtPassword,$password);
I love it when a program comes together - jdhannibal

In reply to Please Help! Submit User Login Form... by jdlev

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.