Skip to content

Commit

Permalink
Cleanup deprecation warnings, ReadMe reword
Browse files Browse the repository at this point in the history
  • Loading branch information
airelil committed Dec 8, 2018
1 parent b3db680 commit af1e40f
Show file tree
Hide file tree
Showing 5 changed files with 311 additions and 308 deletions.
55 changes: 29 additions & 26 deletions Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Released under the LGPL v2.1 or later
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
At its simplest it allows you to send mouse and keyboard actions to windows
dialogs and controls.


Installation
Manual Installation
------------
Install the following Python packages
(Required) pyWin32 http://sourceforge.net/projects/pywin32/files/pywin32/
Expand All @@ -19,10 +19,10 @@ Unzip the pywinauto zip file to a folder.
Run "python setup.py install"

To check you have it installed correctly
run Python
run in Python REPL:
>>> from pywinauto.application import Application
>>> app = Application.start("notepad.exe")
>>> app.UntitledNotepad.TypeKeys("%FX")
>>> app.UntitledNotepad.type_keys("%FX")

Installation in silent mode (Python 2.7, 3.3+)
------------
Expand All @@ -32,16 +32,17 @@ Installation in silent mode (Python 2.7, 3.3+)
Where to start
--------------
The Getting Started Guide: https://pywinauto.readthedocs.io/en/latest/getting_started.html
It explains the core concept, how to choose appropriate backend, spy tool and many other things.
It explains the core concept, how to choose appropriate backend, spy tools and many other things.

Also there are examples in there to work with Notepad, MSPaint, WireShark, explorer.exe etc.

Note: These examples currently only work on English.
We also have several examples installed along with the pywinauto demonstrating the work with
Notepad, MSPaint, WireShark, explorer.exe and etc.
https://github.com/pywinauto/pywinauto/tree/master/examples
Notice though these examples designed to work only on a system with English localization.


How does it work
----------------
A lot is done through attribute access (__getattr__) for each class. For example
A lot is done through attribute access (__getattr__) for each class. For instance,
when you get the attribute of an Application or Dialog object it looks for a
dialog or control (respectively).

Expand All @@ -52,33 +53,35 @@ 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.
The attribute resolution is delayed (at the present with a hard coded time limit) until
it succeeds. So for example, if you select a menu option and then look for the
resulting dialog e.g. with the following code:

app.Notepad.MenuSelect("File->SaveAs")
app.SaveAs.ComboBox5.Select("UTF-8")
app.SaveAs.edit1.SetText("Example-utf8.txt")
app.SaveAs.Save.Click()
app.Notepad.menu_select("File->SaveAs")
app.SaveAs.ComboBox5.select("UTF-8")
app.SaveAs.edit1.set_text("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!)
before resolving the dialog. At that point, if we can't find a SaveAs dialog with
a ComboBox5 control we wait a short period of time and try again.
The procedure repeats up to a maximum time limit (currently 1 second!)

This avoid the user having to use time.sleep or a "WaitForDialog" function.
This internal waiting loop is to avoid the user having to use time.sleep or
implementing a custom "wait_for_dialog" function.

If your application performs long time operation, new dialog can appear or
disappear later. You can wait for its new state like so ::
However, if your application performs particularly long-standing operations, it can
still take time for a new dialog to appear or disappear. In that case, you could
wait for the transition to a new state like so ::

app.Open.Open.Click() # opening large file
app.Open.Open.click() # opening large file
app.Open.wait_not('visible') # make sure "Open" dialog became invisible
# wait for up to 30 seconds until data.txt is loaded
# wait up to 30 seconds until data.txt is loaded
app.window(title='data.txt - Notepad').wait('ready', timeout=30)


Some similar tools for comparison
Several similar tools for comparison
---------------------------------
* Python tools

Expand All @@ -94,7 +97,7 @@ Some similar tools for comparison
* Other free tools

- AutoIt
- See collection at: https://github.com/atinfo/awesome-test-automation
- See a collection at: https://github.com/atinfo/awesome-test-automation

* Commercial tools

Expand Down
Loading

0 comments on commit af1e40f

Please sign in to comment.