Web Interface Testing Question
- Hi all-
I'm still in the process of learning Perl in general--and completely
new to the guitest module. I don't know if anyone here can answer my
question---but perhaps someone can refer me to a reference source or
even another module.
Let's say that I want to write a script that will load www.yahoo.com,
enter the word "bubba" into the search box and click on the "Submit"
button. Now, I know I can do this by using tab-stops or pixel
location, but obviously...this wouldn't be the best way to write a
Is there a way for me to get a perl script to recognize a field or
button on a webpage as a field or button entity?
Thanks for any advice you can give---and also for your patience with
my limited knowledge.
--- In perlguitest@y..., "seraph_15217" <seraph_15217@y...> wrote:
> button. Now, I know I can do this by using tab-stops or pixel
> location, but obviously...this wouldn't be the best way to write a
> test script.
> Is there a way for me to get a perl script to recognize a field or
> button on a webpage as a field or button entity?
If you look at the test code that comes with the module (t/basic.t)
you'll see how I play some tricks with the windows calculator app.
The examples in the eg directory should also help you.
Normally you can look for window by name or by window class. The
window class can tell you things like "it is an edit box". The window
name/caption/title will tell you "it is the button called OK".
If you're afraid that the programmers will change the order of the
buttons or the names (hence TAB won't work), then the safest thing is
probably to use keyboard shortcuts. I.e. on IExplorer you can get to
the address bar you mentioned using ALT+D (A[d]dress). Win32::GuiTest
allows sending this type of key combination.
Of course programmers may also change a shortcut, but that is
normally a bigger change and they will have to tell you about it
- Forgot another thing: you can use spy--.pl (in the eg directory) to
see all the window and window class names you currently have open.
+0x00020042, 'Program Manager', Progman
++0x0002003E, '', SHELLDLL_DefView
+++0x0002003A, '', SysListView32
++++0x00010058, '', SysHeader32
The format is handle number, window title, window class. The + signs
are to help track which ones are child windows.
-- Ernesto Guisado (mailto:erngui@..., http://triumvir.org)