Switched pywinauto readme and pydlgchecks readme names

This commit is contained in:
markm 2006-01-15 19:58:08 +00:00
parent 5d0207cada
commit c58e6b2852
1 changed files with 80 additions and 27 deletions

View File

@ -1,31 +1,84 @@
Unzip the Zip file
Copy (though you could move also) Python24.dll, dlgchecks2.dll and move
PythonConfig.py to the folder that contains your executable (Silktest
directory).
Modify PythonConfig.py to point to where you have unzipped the other
files (this folder should contain all the *.py files and the Python24.zip
file.
If your machine does not have the appropriate Visual Studio 7 DLLs you
will also need these in the executable directory. (Included in the Zip
in RequiredDLLs).
pywinauto
(c) Mark Mc Mahon 2006
Released under the LGPL licence
There is also a little sample FindDialog.exe application (it does not use
the DLL - but the underlying Python libraries). What it does is perform most
of the tests (it doesn't do AllControls or AsianHotkeyTests) and highlights
controls with errors with a red rectangle.
What is it
----------
pywinauto is a set of python modules to automate the Microsoft Windows GUI.
At it's simplest it allows you to send mouse and keyboard actions to windows
dialogs and controls.
Mostly you need to run this dialog with a regular expresion as the dialog
title e.g.
FindDialog "^Explorer"
#(the ^ is to make sure you don't match the Command prompt window you are in!)
But you could use other regular expressions also e.g. - the first windows
with 'Document' in the title,
".*[D]ocument.*" (again the [ and ] are to make sure that the current
command prompt window is not found!)
Note that this file needs Python24.dll - so if you have moved it out - this
program will not work!.
Installation
------------
Unzip the pywinauto zip file to a folder.
Install the following Python packages
ctypes http://starship.python.net/crew/theller/ctypes/
Sendkeys http://www.rutherfurd.net/python/sendkeys/index.html
(Optional) PIL http://www.pythonware.com/products/pil/index.htm
(Optional) elementtree http://effbot.org/downloads/
To check you have it installed correctly
run Python
>>> import application
>>> app = application.Application()._start("notepad")
>>> app.notepad.TypeKeys("%FX")
Where to start
--------------
Look at the examples provided in test_application.py
There are examples in there to work with Notepad and MSPaint.
How does it work
----------------
A lot is done through attribute access (__getattr__) for each class. For example
when you get the attribute of an Application or Dialog object it looks for a
dialog or control (respectively).
myapp.Notepad # looks for a Window/Dialog of your app that has a title 'similar'
# to "Notepad"
myapp.PageSetup.OK # looks first for a dialog with a title like "PageSetup"
# then it looks for a control on that dialog with a title
# like "OK"
This attribute resolution is delayed (currently a hard coded amount of time) until
it succeeds. So for example if you Select a menu option and then look for the
resulting dialog e.g.
app.Notepad.MenuSelect("File->SaveAs")
app.SaveAs.ComboBox5.Select("UTF-8")
app.SaveAs.edit1.SetText("Example-utf8.txt")
app.SaveAs.Save.Click()
At the 2nd line the SaveAs dialog might not be open by the time this line is
executed. So what happens is that we wait until we have a control to resolve
before resolving the dialog. At that point if we can't find a SaveAs dialog with
a ComboBox5 control then we wait a very short period of time and try again,
this is repeated up to a maximum time (currently 1 second!)
This avoid the user having to use time.sleep or a "WaitForDialog" function.
Some similar tools for comparison
---------------------------------
* Python tools
- Watsup
- winGuiAuto
* Other scripting language tools
- Perl Win32::GuiTest
- Ruby GuiTest
- others?
* Other free tools
- AutoIt
- See collection at:
* Commercial tools
- WinRunner
- SilkTest
- Visual Test
- Many Others