Hello All. I hope that one of you programming wizards out there can help me!

I am trying to script a program to autologin for me with the following HTML code data. Although for some reason I can not seem to be able to fill the password field properly with WWW::Mechanize. Is the some hidden jewel of syntax structure I am not yet aware of? Any help concerning this issue would be much appreciated! :)

Please contact me as soon as you can to let me know!

Thanks in advance.

_______________________________________________________________

#!usr/bin/perl use WWW::Mechanize; use WWW::Mechanize::FormFiller; my $mech = WWW::Mechanize->new() my $formfiller = WWW::Mechanize::FormFiller->new(); my $username = "user_name"; my $password = "password"; my $url = "http://www.myurl.com/default.aspx"; # Grab the home page, and click the login button to redirect to the correct page(HTML listed below). $mech->get($url); $mech->click_button(number => 1); # Set the username and password fields accordingly and submit. $mech->set_visible( $username, [password => $password] ) ; $mech->submit(); # Store new HTML content in a temporary file and open it for viewing. $html = $mech->content(); open (OUT,">tmp.html"); print OUT $html; close (OUT); system("tmp.html");
_______________________________________________________________
<html> <head> <title>Login</title> </head> <body bgcolor="#FFFFFF"> <form id="frmLogin" name="frmLogin" method="post" action="Login.aspx?__ufps=933290"> <input type="hidden" name="__VIEWSTATE" value="aDxfX1A7QDw716znrKftnYTgo4csMTs+ Oz6urRmZvy6aJZj20y+gGEkgSS1/NA +=="> <input type="hidden" name="__EVENTTARGET" value=""> <input type="hidden" name="__EVENTARGUMENT" value=""> <script language=javascript><!-- function __doPostBack(target, argument){ var theform = document.frmLogin theform.__EVENTTARGET.value = target theform.__EVENTARGUMENT.value = argument theform.submit() } // --> </script> <font size="-1" color="Black">Authorized users, please enter your trading user ID and password:<br> Please enter your user ID:<br> <input name="txtUID" size="32"/><br> Please enter your password:<br> <input name="txtPWD" size="32" type="password"/><br> <input name="cmdGo" type="image" src="Brand/00/go.gif" alt="Go"/><br> <input name="cmdHomeFromfrmLogin" type="image" src="Brand/00/home.gif" alt="Home"/></font></form></body></html>

20050106 Janitored by Corion: Put code and HTML inbetween code tags


In reply to www: mechanize autologin issue by hiverbee

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.