Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: WWW::Mechanize - Unable to fill password field

by 7stud (Deacon)
on Jan 03, 2015 at 23:15 UTC ( [id://1112079]=note: print w/replies, xml ) Need Help??


in reply to WWW::Mechanize - Unable to fill password field

Your code works fine for me in conjunction with the following html and cgi script:

index.html:
<!DOCTYPE html> <html> <head><title>Python CGI</title></head> <body> <form action="cgi-bin/mycgi.pl" method="post"> <div> <label for="name">User Name:</label> <input id="name" name="ctl00$cntPlaceHolder$UsernameTextBox" typ +e="text"> </div> <div> <label for="password">Last Name:</label> <input id="password" name="ctl00$cntPlaceHolder$PasswordTextBox" + type="password"> </div> <div> <input type="submit" value="submit"> </div> </form> </body> </html>
mycgi.pl:
#!/usr/bin/env perl use CGI; use CGI::Carp qw{ fatalsToBrowser }; my $cgi = CGI->new; print $cgi->header, $cgi->start_html('Test Page'), $cgi->h4('Params:'), $cgi->div('Name: ' . $cgi->param('ctl00$cntPlaceHolder$UsernameT +extBox')), $cgi->div('Password: ' . $cgi->param('ctl00$cntPlaceHolder$Passw +ordTextBox')), $cgi->end_html;

HTML Code after clicking view source

But what does your program output from the following line:

print $page;

Replies are listed 'Best First'.
Re^2: WWW::Mechanize - Unable to fill password field
by doubledecker (Scribe) on Jan 05, 2015 at 07:39 UTC

    When I print the page, I get the HTML code with the username filled with 'admin'. But, I don't see any value populated for password field. This is not allowing to submit the page.

    In my original post, I have given the code with username field with value but not for password field.

    Is this something related to SSO login of the website which is restricting to input password field

      why don't you submit what you need to without using set_fields...?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-26 06:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found