Subject: | getPopupWindow warnings and errors (+possible fix) |
Date: | Wed, 20 Jul 2011 12:47:31 +0300 |
To: | bug-Win32-Watir [...] rt.cpan.org |
From: | Сергій Парубочий <s.parubochiy [...] gmail.com> |
Win32-Watir-0.05
in Watir.pm:
Problems:
1. $counter is not initialized
2. $window->document is not alway defined and thus we get runtime error
sub getPopupWindow {
my $self = shift;
my ($what, $wait) = @_;
* my $counter = 0;*
$wait = 2 unless $wait;
while($counter <= $wait ){
my $shApp = Win32::OLE->new("Shell.Application") || die "Could not start
Shell.Application\n";
my $windows = $shApp->Windows;
for (my $n = 0; $n <= $windows->count - 1; $n++){
my $window = $windows->Item($n);
my $title = $window->document->title if $window* && defined
$window->document*;
if ($title eq $what){
my %popup = %{$self};
my $popupref = \%popup;
$popupref->{agent} = $window;
bless $popupref;
$popupref->WaitforDone;
return $popupref;
}
}
sleep 1;
$counter++
}
$self->_log("WARNING: No popup window is present with your specified title:
$what");
}
Text in bold were altered and helped to resolve the issue.
--
Sergey Parubochiy