Problem with IE automation in Perl

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hello All,

I am looking to automate IE search using Perl. The site I am trying to
access has a security certificate and I am trying to send an enter
command to just click 'OK' on the security dialog box that opens. I
tried win32::IEAutomation in combination with win32::winclicker which
probably has the exact method to do this but somehow in my case, it is
not able to recognize the dialog box i feel. Here is the code I have.
Please take a look and let me know where I am possibly going wrong:

 use strict;
 use Win32::OLE;
 use Win32::OLE::Const 'Microsoft Excel';
  use Win32::IEAutomation;
 use Win32::IEAutomation::WinClicker; # this will provide methods to
interact with dialog box
 #use Win32::GuiTest; # qw(FindWindowLike GetWindowText
SetForegroundWindow SendKeys);

 my $title ='Choose a digital certificate';
 my $wait= 5;

 # Creating new instance of Internet Explorer

my $ie = Win32::IEAutomation->new( visible => 1);

# Site navigation


# managing security dialog boxes

   my $clicker = Win32::IEAutomation::WinClicker->new();
   $ie->WaitforDone; # we will wait here for complete loading of
navigated site

The push confirm method is as follows :

sub push_confirm_button_ok{

    print "hello inside yes loop \n";
    my ($self, $title,$wait) = @_;
    print "$self \n$title \n$wait \n";
    $wait = 5 unless $wait;
    my $window = $self->->WinWait($title, "", $wait);
    if ($window){
        print "break 4 inside open window loop \n";
        print "WARNING: No Security Alert dialog is present. Function
push_security_alert_yes is timed out.\n" if $warn;

It is never entering the break point 4 which means that $window is not
recognized. What could be the reason ?

Thanks a lot

Re: Problem with IE automation in Perl

Quoted text here. Click to load it

I've never used those modules. You might try using Win32::GuiTest to
send ENTER to that dialog:

use Win32::GuiTest qw(SendKeys SetForegroundWindow WaitWindow);

my $whdl = WaitWindow($title,$wait) || die "Window '$title' not found.
SetForegroundWindow($whdl) || die "could not set foreround window

Site Timeline