in reply to Re^10: How do I click Javascript button with Win32::IE::Mechanize
in thread How do I click Javascript button with Win32::IE::Mechanize
and my script is<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=windows-1252 +"> <META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD> <BODY><PRE><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitiona +l//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset +=iso-8859-1"> <TITLE>Consulting Plus - Single Sign-On</TITLE> <link rel="stylesheet" href="../style/MenuBar.css"> <script language="JavaScript" type="text/script"> function doSubmit() { document.ctlogonform.method="post"; document.ctlogonform.action="cp_logon_ct.html"; document.ctlogonform.submit(); } </script> </HEAD> <BODY bgcolor="#999999" class="linkColor" vlink="FFFFFF"> <table width="1004" border="0" cellspacing="0" cellpadding= +"0"> <tr> <td bgcolor="#FFFFFF" width="4">&nbsp;</td> +; <td rowspan="2" bgcolor="#FFFFFF" width="222"><im +g src="../images/qwest_blu_wht1.gif" alt=""></td> <td width="381" bgcolor="#FFFFFF">&nbsp;</td& +gt; <td colspan="2" bgcolor="#FFFFFF"> <div align="right"> </div> </td> <td width="4" class="qwestBlueBGColor" height="16">& +amp;nbsp;</td> </tr> <tr> <td bgcolor="#FFFFFF" width="4">&nbsp;</td> +; <td colspan="3" bgcolor="#FFFFFF" height="77"> <font color="006699" size="2"><b>Consulting Pl +us - Single Sign-On</b></font> </td> <td width="4" class="qwestBlueBGColor">&nbsp;< +;/td> </tr> <tr> <td width="4" class="qwestBlueBGColor">&nbsp;< +;/td> <td width="222" class="qwestBlueBGColor">&nbsp;& +lt;/td> <td width="381" class="qwestBlueBGColor">&nbsp;& +lt;/td> <td width="222" class="qwestBlueBGColor">&nbsp;& +lt;/td> <td width="184" class="qwestBlueBGColor">&nbsp;& +lt;/td> <td width="4" class="qwestBlueBGColor">&nbsp;< +;/td> </tr> <tr> <td width="4" class="formBodyBGColor" height="21">&a +mp;nbsp;</td> <td width="222" class="pagename" height="21">SIGN O +N</td> <td colspan="3" class="message" height="21" >&n +bsp;&nbsp;To access Consulting Plus, Please enter your CUID and P +assword then click the SIGN ON button.</td> <td width="4" class="qwestBlueBGColor" height="21">& +amp;nbsp;</td> </tr> <tr> <td width="4" class="formBodyBGColor">&nbsp;</td& +gt; <td colspan="4" class="formBodyBGColor"> <FORM name="ctlogonform" ACTION="cp_logon_ct.html" METHOD=P +OST ACCEPT-CHARSET="UTF-8"> <INPUT TYPE="hidden" NAME="auth_mode" VALUE="basic"> <table border=0 cellpadding=10 cellspacing=0 width="100 +%"> <tr> <td valign=top> <table border=0 cellpadding=0 cellspacing=0 wid +th="100%"> <tr> <td width="50%"><img src="../imag +es/spacer.gif" alt="" width=1 height=1 border=0></td> <td width="50%"><img src="../imag +es/spacer.gif" alt="" width=1 height=1 border=0></td> </tr> <tr> <td valign=top><FONT COLOR="#FF00 +00" FACE="Arial" SIZE="2"></FONT></td> </tr> <tr> <td colspan="2"><img src="../i +mages/spacer.gif" alt="" width=1 height=10 border=0></td> </tr> <tr> <td valign=top> <font face="Arial" size=2><b>C +UID:</b></font> <br> <input type="text" name="user" value="" + maxlength="26" size="22" > </td> <td valign=top> <font face="Arial" size=2>< +;b>Password:</b></font> <br> <INPUT TYPE="password" NAME="p +assword" VALUE="" SIZE="22" MAXLENGTH="20"> </td> </tr> </table> </td> </tr> </table> </FORM> </td> <td width="4" class="qwestBlueBGColor">&nbsp;</td +> </tr> <tr> <td colspan="6" class="qwestBlueBGColor" height="16"> +; <table border="0" cellpadding="0" width="100%" bgcolor= +"#000000"> <tr> <td valign=TOP width="2%"></td> <td valign=TOP width="32%">&nbsp;</td +> <td align=CENTER valign=TOP width="32%"> <div align="CENTER" ><a class="navBar +Bottom2" href="javascript:document.forms[0].reset();" >RESET</a +></div> <td> <td align=RIGHT valign=TOP width="32%"> <div align="RIGHT"><a href="javascrip +t:document.forms[0].submit();" class="navBarBottom2">SIGN ON</a +></div> </td> <td valign=TOP width="2%"></td> </tr> </table> </td> </tr> <tr> <td colspan="6" class="qwestBlueBGColor"> <div align="right"><img src="../images/qwest_ +cygent_basea.gif" alt="" width="1000" height="3"></div> </td> </tr> <tr> <td width="4" bgcolor="ffffff" height="24">&nbsp +;</td> <td colspan="3" bgcolor="ffffff" height="24"> </td> <td colspan="2" bgcolor="ffffff" height="24"> <div align="right"><img src="../images/qwest_ +RSA_gray.gif" alt="" width="187" height="39"></div> </td> </tr> <tr> <td colspan="6" bgcolor="#3E6679"> <div align="right"><img src="../images/qwest_ +cygent_baseb_gray.gif" alt="" width="1000" height="3"></div> </td> </tr> </table> </BODY> </HTML> </PRE></BODY></HTML>
script is able to load the page and passing the inputs but its not hitting the SIGN ON button. Thanks#!/usr/bin/perl #use strict; #use warnings; use Win32::IE::Mechanize; my $ie = Win32::IE::Mechanize->new( visible => 1); my $url ='http://test.html'; #dummy url $ie->get( $url ); $ie->set_visible($username,$password ); # $ie->follow_link("javascript:document.forms[0].submit();"); $ie->find_link(url => "javascript:document.forms[0].submit();")|| die + "can't call $!";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^12: How do I click Javascript button with Win32::IE::Mechanize
by marto (Cardinal) on Dec 27, 2007 at 13:50 UTC |