This code is working Windows XP and not in Windows 7, built with
ActiveState libs. It failed on a remote test sorry I do not have debug
data. I will forward debug results along when I get a win7 development env.
Nature of problem is that IT starts up and is visible and Mechanize can
not communicate with IE.
Subject: | CSPauth.pm |
package ActionDeskTopModules::CSPauth;
# $Header: /opt/actionCM/actiondesktopPerl/ActionDeskTopModules/CSPauth.pm,v 1.1 2010/09/20 21:55:34 kt161n Exp $
# REVSIONS at EOF
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw();
use Win32::IE::Mechanize;
#use Win32::IE::Form;
use lib 'C:/cygwin/home/kt161n/projcode/actiondesktopPerl';
use ActionDeskTopModules::Common qw(:globalcommon :security :system );
sub CSPAuthenticate {
my ($params) = @_ ;
if (ref( $params ) ne 'HASH') {
return -1 ;
}
$CSPloginname = $params->{"name"};
$CSPloginpassword = $params->{"password"};
if ( length ($CSPloginname) < 1 ) { return 2; }
if ( length ($CSPloginpassword) < 1 ) { return 3; }
#return 1; #for debug, below is working
my $ie = Win32::IE::Mechanize->new( visible => 0 );
my $url = 'https://www.e-access.att.com/empsvcs/hrpinmgt/pagLogin/';
$ie->get( $url );
sleep(3); # let page load
my $content = $ie->content();
#print "content = $content \n\n";
if ( $content =~ /Successful/) {
#print "OK\n";
$ie->close();
return 1;
}
my $title = $ie->title();
my $agent = $ie->agent();
#print "title = $title\n";
$ie->field('userid',$CSPloginname);
$ie->field('password',$CSPloginpassword);
$ie->click('btnSubmit');
sleep(3); # let response page load
$content = $ie->content();
#print "content = $content \n\n";
if ( $content =~ /Successful/) {
#print "OK\n";
$ie->close();
$ie = undef;
return 1;
}
$ie->close();
return 0;
}
1;
# $Log: CSPauth.pm,v $
# Revision 1.1 2010/09/20 21:55:34 kt161n
# separate windows API and activestate browser code runtime defect.
#