Has anyone had any experience using GUITest with Foxpro or other COM object Applications? My ultimate goal is to be able to automagically drive foxpro and other applications as part of the software testing process.
I'd be interested in hearing your experiences. Some of the apps I want to automate/test use foxpro classes and others use Active X. The method I used to find all the controls does not seem able to look inside these entities.
I have a handle for the control but I am at a loss as to how to proceed.
How do I expose their buttons or other features so that I can activate them from a test script?
I think Win32::OLE might provide some help but the examples seem geared for a different purpose and I do not yet understand them.
Any help or suggestions would be greatly appreciated.
Script and output I used are posted below:
Script
use strict;
use Win32::GUI @Win32::GUI::EXPORT_OK;
use Win32::GuiTest @Win32::GuiTest::EXPORT_OK;
use Data::Dumper;
# Purpose Find Management and list all contents.
$Win32::GuiTest::debug = 1;
# Find StrataQA
my @winHandle = FindWindowLike (undef,"Management");
unless (@winHandle != 0 ) { "No Management Window Found!!!\n";}
print "Found Management Window.\n";
SetForegroundWindow ($winHandle[0]);
# List Children
my @winChildren = FindWindowLike ($winHandle[0]);
print "There are ". @winChildren." children\n";
#List Children's Children
foreach my $hChild (@winChildren){
print "For $hChild\n";
my @hGchildren = FindWindowLike ($hChild);
print "There are ". @hGchildren." children for $hChild)\n\n";
}
Output
Found Management Window.
Window Found(Text : '' Class : 'stratamgm8c000000' Handle: '591244')
Window Found(Text : '' Class : 'CtlFrameWork_ReflectWindow'
Handle: '853406')
Window Found(Text : '' Class : 'StatusBar20WndClass'
Handle: '1181028')
Window Found(Text : '' Class : 'AfxOleControl42' Handle: '1181024')
Window Found(Text : '' Class : 'AfxWnd42' Handle: '1181016')
There are 5 children
For 591244
Window Found(Text : '' Class : 'CtlFrameWork_ReflectWindow'
Handle: '853406')
Window Found(Text : '' Class : 'StatusBar20WndClass'
Handle: '1181028')
Window Found(Text : '' Class : 'AfxOleControl42' Handle: '1181024')
Window Found(Text : '' Class : 'AfxWnd42' Handle: '1181016')
There are 4 children for 591244)
For 853406
Window Found(Text : '' Class : 'StatusBar20WndClass'
Handle: '1181028')
There are 1 children for 853406)
For 1181028
There are 0 children for 1181028)
For 1181024
Window Found(Text : '' Class : 'AfxWnd42' Handle: '1181016')
There are 1 children for 1181024)
For 1181016
There are 0 children for 1181016)