Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Please Help! Submit User Login Form...

by jdlev (Scribe)
on Nov 04, 2013 at 18:35 UTC ( #1061173=perlquestion: print w/replies, xml ) Need Help??
jdlev has asked for the wisdom of the Perl Monks concerning the following question:

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" 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 = ""; print $url; $mech->get( $url ); $mech->field(txtUserName,$username); $mech->field(txtPassword,$password);
I love it when a program comes together - jdhannibal

Replies are listed 'Best First'.
Re: Please Help! Submit User Login Form...
by LanX (Bishop) on Nov 04, 2013 at 18:38 UTC
    That's a FAQ (once per week?)

    Did you search for " WWW::Mechanize javascript "?

    Did yoy read the docs of WWW::Mechanize ?

    > Please Help!

    Plz read! :)

    Cheers Rolf

    ( addicted to the Perl Programming Language)

Re: Please Help! Submit User Login Form...
by ww (Archbishop) on Nov 04, 2013 at 20:45 UTC
    ...and, please, next time you have some heavily indented html to post, do everyone a favor, and reduce the indentation (to something like 2 or 3 spaces).

    What you posted appears to have something like 40-space indents. That's a tad of overkill.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1061173]
Approved by ww
[erix]: ( and when teleology was brought up, during my biology-study., I couldn't get an answer either )
[1nickt]: FTR I agree with you about "design." Just not sure about the trajectory of evolution. THere are a lot of dead-ends in the evolutionary paths. I suspect homo sapiens is just one of them.
[james28909]: thanks for the vid holli, i do like it. thanks for sharing :)
[holli]: gives me goosebumps every time I watch it
holli gotta grab some groceries before dawn. l8ters
[erix]: s/dawn/dusk/
[erix]: (you're welcome :P)
[james28909]: you know, i had a thought a few mnths back. what if this universe were just a puzzle, waiting for life to figure it out!
[james28909]: what if one day we are able to grab the curtain that is "spacetime" and pull it back to reveal <insert imagination here> pulling at levers and ropes xD

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (12)
As of 2017-12-15 14:39 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (433 votes). Check out past polls.