CC: | "dneels1980 [...] yahoo.com" <dneels1980 [...] yahoo.com> |
Subject: | Not able to make the IEAutomation.pm working on IE 10 and IE 11 |
Date: | Tue, 15 Dec 2015 05:51:27 +0000 |
To: | "bug-Win32-IEAutomation [...] rt.cpan.org" <bug-Win32-IEAutomation [...] rt.cpan.org> |
From: | "Deshpande, Nilesh" <Nilesh_Deshpande [...] BMC.com> |
Simple question is, can I make this PM working on Internet explorer 10 and internet explorer 11. It works good on Internet Explorer 6.0. But not on 10 and 11. I send all details below, let me know the work around or fix if you have with you.
Problem 1) Not able to make the IEAutomation.pm working on IE 10 and IE 11
1) Can't call method "readystate" on an undefined value at ../../perl_modules/Win32/IEAutomation.pm line 561.
So I proceeded with
sub WaitforDone{
my $self = shift;
my $agent = $self->{agent};
# while ($agent->Busy || $agent->document->readystate ne "complete"){
sleep 1;
# }
}
Problem 2) Can't call method "all" on an undefined value at ../../perl_modules/Win32/IEAutomation.pm line 290.
sub getTextBox{
my ($self, $how, $what) = @_;
my $agent = $self->{agent};
my ($inputs, $target_field);
if ($how eq "beforetext:" || $how eq "aftertext:"){
$inputs = $agent->Document->all;
}else{
$inputs = $agent->Document->all->tags("input");
}
if ($inputs){
$target_field = __getObject($inputs, $how, $what, "text|password|file");
}
my $text_object;
if ($target_field){
$text_object = Win32::IEAutomation::Element->new();
$text_object->{element} = $target_field;
$text_object->{parent} = $self;
}else{
$text_object = undef;
print "WARNING: No text box is present in the document with your specified option $how $what\n" if $warn;
}
return $text_object;
}
Source Code
# Include required modules
use lib "./../../perl_modules";
use lib "./../pportal_modules";
use strict;
use Win32::OLE qw(in with);
use Getopt::Std;
use Win32::IEAutomation;
use Win32::IEAutomation::WinClicker;
use Win32::IEAutomation::Table;
use BPM::Common;
use PORTAL::Functions;
use Cwd;
use warnings;
use Win32::IEAutomation;
my $ie = Win32::IEAutomation->new( visible => 1);
$ie->gotoURL('https://MyURL/portal/login/login.do');
#This has 2 text boxes in it username and password.
#my $about = $ie->getLink('linktext:' => 'About')
# or die "Unable to find About";
# $about->Click(); # <--- does not work, using alternative method
#$ie->gotoURL($about->linkUrl());
#my $about = $ie->getLink('linktext:' => 'Log On');
$ie->getTextBox('id:', "username")->SetValue('user');
$ie->getTextBox('id:', "password")->SetValue('user');
#I tried with id: and name: both. It has same error
$ie->getButton('value:', "Log On")->Click;
#my $btn=$ie->getButton(value:","Log On");
#print $btn;
#$btn->Click;
#$about->Click();
Thanks,
Nilesh
Message body is not shown because it is too large.