Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Submitting Forms for .NET Sites Problem

by Charli (Initiate)
on May 08, 2015 at 06:56 UTC ( [id://1126065]=note: print w/replies, xml ) Need Help??


in reply to Re: Submitting Forms for .NET Sites Problem
in thread Submitting Forms for .NET Sites Problem

Hi,
Please see below code snippet for the HTML form for your reference.

<div id="loginArea"> <div id="loginMessage" class="groupMargin">Sign in with your a +ccount</div> <form method="post" id="Login" autocomplete="off" novalidate=" +novalidate" onkeypress="if (event &amp;&amp; event.keyCode == 13) Log +in.submitLoginRequest();" action=""> <div id="formsAuthenticationArea"> <div id="userNameArea"> <input id="userNameInput" name="UserName" type="em +ail" value="" tabindex="1" class="text fullWidth" spellcheck="false" +placeholder="Username" autocomplete="off"> </div> <div id="passwordArea"> <input id="passwordInput" name="Password" type="p +assword" tabindex="2" class="text fullWidth" placeholder="Password" a +utocomplete="off"> </div> <div id="kmsiArea" style="display:none"> <input type="checkbox" name="Kmsi" id="kmsiInput" +value="true" tabindex="3"> <label for="kmsiInput">Keep me signed in</label> </div> <div id="submissionArea" class="submitMargin"> <span id="submitButton" class="submit" tabindex="4 +" onkeypress="if (event &amp;&amp; event.keyCode == 32) Login.submitL +oginRequest();" onclick="return Login.submitLoginRequest();">Sign in< +/span> </div> </div> </form> </div>

Yes, the login site is not mine, but I wanted to submit the form with the credentials that I have for me to be able to go through to the site I intended to go.
We used WWW::Mechanize for this using the code snippet below:
my $mech = WWW::Mechanize->new(); $response = $mech->get($URL); $mech->submit_form( fields => { UserName => $username, Password => $password, },);

but I am unable to go through the login site. I suspect that it is because of the JavaScript that is in the form and or the span.
Any suggestions or advice on how to submit the form?

Your help is highly appreciated. Thank you in advance.

Replies are listed 'Best First'.
Re^3: Submitting Forms for .NET Sites Problem
by ww (Archbishop) on May 08, 2015 at 10:53 UTC
Re^3: Submitting Forms for .NET Sites Problem
by Gangabass (Vicar) on May 09, 2015 at 03:04 UTC
    Can you post Login.submitLoginRequest() definition?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1126065]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-04-24 10:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found