shayak has asked for the wisdom of the Perl Monks concerning the following question:
#! usr/bin/perl #use Win32::Gui; use Win32::GuiTest qw(:ALL); use strict; my $window = FindWindowLike( undef,"Setup","" ); while( $window = FindWindowLike( undef,"Setup","" )) { SetForegroundWindow($window); my @hwnds = FindWindowLike(GetChildWindows($window)); #my @hwnds = GetChildWindows($window); foreach (@hwnds) { #SetActiveWindow($_); GetFocus($_); my $WinTxt = GetWindowText($_); print $WinTxt; print "\n"; my $class = GetClassName($_); print $class; if($class =~ /^(TNewRadioButton|radiobutton|Radiobutto +n|RadioButton|Button|TRadioButton)$/) { my $id=GetWindowID($_); my $text = WMGetText($_); #my $wintxt=GetWindowText($child); if ($text =~ /^(I &accept the agreement|agree|Agre +e|Accept|I agree to the terms of this license agreement|Install|insta +ll|I accept the license agreement|I &accept the terms in the License +Agreement)$/) { CheckButton($id) || MouseClick($id); #SendKeys($child); #SendKeys("~"); #PushButton("Next"); } } if($class =~ /^(Checkbox|checkbox|TNewCheckListBox|Che +ckListBox|CheckBox|Button|button|TRzCheckBox)$/) { my $id=GetWindowID($_); my $text = WMGetText($_); #my $wintxt=GetWindowText($id); #print $id; #print "\n"; CheckButton($id) || MouseClick($id); #SendKeys($_); #if ($text =~ /^(I &accept the agreement|agree|Agr +ee|Accept|I agree to the terms of this license agreement|Install|inst +all| I accept the license agreement)$/) #{ #MouseClick($id) && CheckButton($id); #CheckButton($id); #|| MouseClick($id); #PushButton("Next"); #} } if($class =~ /^(Button|button|TNewButton|TButton|&Butt +on)$/) { my $id=GetWindowID($_); my $text = WMGetText($id); #my $wintxt=GetWindowText($id) if($text !~ /^(Cancel|cancel|back|Back|&Back|&Canc +el|&<Back|<back|<Back)$/) { PushButton('Next|Agree|Install|Finish|Done|Ok')||( +PushButton('Select All') && (PushButton('Finish|Next|Agree|Install|Cl +ose|Yes'))) ; } } PushButton('Next|Agree|Install|Finish|Done|Ok')||(Push +Button('Select All') && (PushButton('Finish|Next|Agree|Install|Close| +Yes'))) ;#|| SendKeys("~") ; } PushButton('Next|Agree|Install|Finish|Done|Ok')||(PushBut +ton('Select All') && (PushButton('Finish|Next|Agree|Install|Close|Yes +'))); #SendKeys("~") ; #PushButton("Next" or "Agree" or " Install" or "Yes" or " +Finish" or "Done" or "Select All"); #} }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Utomation with GUITest
by Corion (Patriarch) on Mar 17, 2011 at 08:13 UTC | |
|
Re: Automation with GUITest
by marto (Cardinal) on Mar 17, 2011 at 11:17 UTC |