I'm quite new to PERL. I'm trying to automate login to an application. Issue: Manually, once I enter the credentials and hit submit, it goes to a processing page and finally automatically goes to the homepage if login is valid. I'm trying to simulate this thru perl mechanize module. The form seems to get submitted, but the print response I get is the HTML of the processing page. My question is: how can I handle this processing page within the script?
This is what I've tried till now;Here is the HTML of the processing page:#! C:/Perl/lib/WWW use WWW::Mechanize; use strict; $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0; my $m = WWW::Mechanize->new(autocheck => 1); my $url="https://rp6.bench.ehc.adp.com/siteminderagent/forms/LSPRH3/lo +gin.fcc?TYPE=33554433&REALMOID=06-7d0449cd-e3ed-10fb-9f50-8498490a0cb +3&GUID=&SMAUTHREASON=0&METHOD=GET&SMAGENTNAME=-SM-s2uV8pMx7pQ%2byUUrf +iIGkme9FfRRMzZ8AkgpHMTZaaKvrgCvd%2fA99CuE2IG3sVvp&TARGET=-SM-https%3a +%2f%2frp6%2ebench%2eehc%2eadp%2ecom%2findex_lsprh%2ehtml"; $m->get($url); $m->success or die "login GET fail"; my $user='bdos0101-b01'; my $pass='bench_0'; my $login = $m->form_name("loginform"); $m->forms; $m->form_name('loginform'); $login->value('USER' => $user); $login->value('password' => $pass); $m->submit(); $m->success or die "login POST fail"; print "Login done\n"; #print $m->content();
Your suggestions/inputs will be greatly appreciated. Regards,Login done <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=content-type content=text/html;charset=ISO-8859-1> <META http-equiv=Refresh content=3;URL=/gamma/z2xcmnmainam/index> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Expires" CONTENT=-1> <META content="Nicolas Laigle" name=author> <LINK media=screen href="index_img/style1.css" rel=stylesheet> <LINK media=screen href="index_img/style2.css" rel=stylesheet> <LINK media=screen href="index_img/style2.css" rel=stylesheet><LINK media=screen href="index_img/style2.css" rel=stylesheet> <META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD> <BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginwidth="0" marginh +eight="0"> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR vAlign=top> <TD vAlign=bottom align=right> <TABLE cellSpacing=7 cellPadding=0 width="100%" border=0> <TBODY> <TR vAlign=bottom> <TD class=top noWrap align=right></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE> <TABLE cellSpacing=14 cellPadding=0 width="100%" border=0> <TBODY> <TR vAlign=top> <TD align=center> <DIV class=h1>Connexion</DIV></TD> <TD align=center><IMG height=50 src="index_img/image1.gif" width=1 border=0></TD></TR> <TR> <TD colSpan=2> <DIV align=center><IMG height=20 src="index_img/image1.gif" width=9 border=0> <TABLE cellSpacing=0 cellPadding=0 width="80%" border=0> <TBODY> <TR> <TD align=middle><IMG height=18 alt=height=24 src="index_img/image2.gif" width=126 border=0><BR><IMG height=30 src="index_img/image1.gif" width=9 border=0> <P class=h4>Chargement en cours ...<BR></P><IMG height=30 src="index_img/image1.gif" width=9 border=0><BR></TD></TR></TBODY></TABLE></DIV><BR></TD></TR +> <TR> <TD colSpan=2></TD></TR></TBODY></TABLE>
In reply to Processing page issue by pdilipm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |