CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Win32 Programming Help:
Problem with IEAutomation.pm

 



jojo101
New User

Aug 25, 2008, 1:32 AM

Post #1 of 5 (8456 views)
Problem with IEAutomation.pm Can't Post

First let me take this oppurtunity to thank all the Friends who spends their precious time in solving others queries.

Hi ,I am trying to automate one of my windows application using the CPAN module IEAutomation.pm by Prasahant Shewale.Following is my code -

#!/usr/bin/perl
use Win32::OLE;
use Win32::IEAutomation;
$IE = Win32::OLE->new("InternetExplorer.Application") || die "Could not start Internet Explorer.Application\n";
$IE = Win32::IEAutomation->new( visible => 1, maximize => 2);
$IE->gotoURL('http://10.255.114.191/snmpconfig.html');
$IE->getButton('caption:',"Configure SNMP v1/v2c" )->Click;
open(OUT, "E:/test/input.txt") || die;
@lines = <OUT>;
foreach $value (@lines)
{
$IE->getTextBox('name:',"get_comm_name")->SetValue("$value");
$IE->getButton('caption:',"Apply")->Click;
sleep 5;
my $popup = $ie->getPopupWindow("Request Acknowledged-Phaser 4510DT");
$popup->getTable('id:', "headingtext");
print $popup;
}
close OUT;
Above script will open the application and enters the values fetching from the file input.txt to the textbox and click on Button.After clicking a message box will pops up saying "Request Acknowledged - No Errors Reported".My requirement is to read the message in the popup window and to be printed on the console.

When i pass value to $title in method getPopupWindow($title),i am getting following error

Can't call method "title" on an undefined value at E:/Perl/site/lib/win32/IEAutomation.pm line 542

I want to know whether this is an error in my code or any changes need to be done in module itself.

Please anyone help on this.I will be more greatful to you guys.


KevinR
Veteran


Aug 25, 2008, 1:57 PM

Post #2 of 5 (8450 views)
Re: [jojo101] Problem with IEAutomation.pm [In reply to] Can't Post

Should this:

$ie->getPopupWindow

be:

$IE->getPopupWindow

perl is case sensitive, $ie and $IE are two different variables. Start using "strict" and "warnings" in your perl scripts, at least while debugging them.
-------------------------------------------------


jojo101
New User

Aug 25, 2008, 11:11 PM

Post #3 of 5 (8443 views)
Re: [KevinR] Problem with IEAutomation.pm [In reply to] Can't Post

Thanks kevin ,

I can see the same error reported even when i changed it $ie to $IE and i have added use strict and use warnings.


KevinR
Veteran


Aug 26, 2008, 12:37 AM

Post #4 of 5 (8438 views)
Re: [jojo101] Problem with IEAutomation.pm [In reply to] Can't Post

Well thats all the help I can be, I don't know anything about that module, but I doubt you want to change anything in the module. You need to determine why there is an undefined value where there should not be one. That is generally the object, like $ie would have been undefined since your objects name is $IE. But apparently that was not the source of your problem.
-------------------------------------------------


DieterDHoker
New User

Sep 13, 2008, 1:41 PM

Post #5 of 5 (7692 views)
Re: [jojo101] Problem with IEAutomation.pm [In reply to] Can't Post


In Reply To
my $popup = $ie->getPopupWindow("Request Acknowledged-Phaser 4510DT");
$popup->getTable('id:', "headingtext");
print $popup;
}
Above script will open the application and enters the values fetching from the file input.txt to the textbox and click on Button.After clicking a message box will pops up saying "Request Acknowledged - No Errors Reported".My requirement is to read the message in the popup window and to be printed on the console.


A message box? Looks like in stead of using the popup window method you need to use the dialog handling methods from this package:


Code
my $clicker = Win32::IEAutomation::WinClicker->new();


There are methods for clicking on YES/NO/OK buttons etc. of dialogboxes but not one for reading what's in it. So you'll have to add a method to the pm file.
Probably at: C:\Perl\site\lib\Win32\IEAutomation\WinClicker.pm
It uses autoit internally ( http://www.autoitscript.com/autoit3/ ) for handling those dialogboxes so you'll have to find out how you can get text from a control using autoit first...

regards,
Dieter D'Hoker


(This post was edited by DieterDHoker on Sep 13, 2008, 1:43 PM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives