Install Pywinauto Windows 7

Install Pywinauto Windows 7 Rating: 3,8/5 6359 votes

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.Just run pip install pywinauto To check you have it installed correctly Run Python frompywinauto.applicationimport Application. Xeplayer Emulator is the Best Android Emulator For PC ever.Download XePlayer Free and install Android Apps & Games for your PC Windows 10,8,7.

pypm install pywinauto

How to install pywinauto

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install pywinauto
Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.4.0 Available View build log
0.1.3 Available View build log
Windows (64-bit)
0.4.0 Failed View build log
0.1.3 Available View build log
Mac OS X (10.5+)
0.4.0 Failed View build log
0.1.3 Available View build log
Linux (32-bit)
0.4.0 Failed View build log
0.1.3 Available View build log
Linux (64-bit)
0.4.0 Failed View build log
0.1.3 Available View build log
Links
Author
License
Imports
Lastest release

At it's simplest it allows you to send mouse and keyboardactions to windows dialogs and controls, but It has support for more complexcontrols also.

0.6+ development is on the roadmap of the Open Source community (https://github.com/pywinauto)

Current 0.5.x maintainance is lead by © Intel Corporation, 2015

© Mark Mc Mahon, 2006-2014

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 windowsdialogs and controls.

Installation¶

  • Install the following Python packages
    • Required pyWin32 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/
    • Optional Pillow (fork of PIL) https://pypi.python.org/pypi/Pillow/2.7.0
  • Download latest pywinauto from https://github.com/pywinauto/pywinauto/releases
  • Unzip the pywinauto zip file to a folder
  • Run python.exesetup.pyinstall

Installation in silent mode¶

(Python 2.7, 3.1, 3.2, 3.3, 3.4, 3.5)

  • Just run pipinstallpywinauto

To check you have it installed correctlyRun Python

How does it work¶

A lot is done through attribute access (__getattr__) for each class. For examplewhen you get the attribute of an Application or Dialog object it looks for adialog or control (respectively).

This attribute resolution is delayed (currently a hard coded amount of time) untilit succeeds. So for example if you Select a menu option and then look for theresulting dialog e.g.

At the 2nd line the SaveAs dialog might not be open by the time this line isexecuted. So what happens is that we wait until we have a control to resolvebefore resolving the dialog. At that point if we can’t find a SaveAs dialog witha ComboBox5 control then we wait a very short period of time and try again,this is repeated up to a maximum time (currently 5 seconds!) Service tool canon ip2770 error code 5b00.

This avoid the user having to use time.sleep or a “Wait” function.

If your application performs long time operation, new dialog can appear ordisappear later. You can wait for its new state like so

Some similar tools for comparison¶

  • Python tools
    • PyAutoGui (https://github.com/asweigart/pyautogui) - it’s a cross-platform but there is no windows/controls manipulation at all.
    • AXUI (https://github.com/xcgspring/AXUI) - this is one of the wrappers around UI Automation API.
    • winGuiAuto (http://www.brunningonline.net/simon/blog/archives/winGuiAuto.py.html) - another module using Win32 API.
  • Other scripting language tools
    • Perl Win32::GuiTest (http://winguitest.sourceforge.net/)
    • Ruby Win32-Autogui (https://github.com/robertwahler/win32-autogui)
    • Ruby RAutomation (https://github.com/jarmo/RAutomation) - there are 3 adapters: Win32 API, UIA, AutoIt.
    • C# Winium.Desktop (https://github.com/2gis/Winium.Desktop)
    • others (http://www.opensourcetesting.org/functional.php)
  • Other free tools
    • AutoIt (http://www.autoitscript.com/)
    • See collection at: https://github.com/atinfo/awesome-test-automation
  • Commercial tools
    • WinRunner (http://www.mercury.com/us/products/quality-center/functional-testing/winrunner/)
    • SilkTest (http://www.segue.com/products/functional-regressional-testing/silktest.asp)
    • Many Others (http://www.testingfaqs.org/t-gui.html)

Why write yet another automation tool if there are so many out there?¶

There are loads of reasons :-)

Takes a different approach:

Most other tools are not object oriented you end up writing stuff like:

I was hoping to create something more userfriendly (and pythonic). For examplethe translation of above would be:

Python makes it easy:
Python is a great programming language, but I didn’t findany automation tools that were Pythonic (I only found onethat was implemented in python) and I didn’t care for ittoo much.
Localization as a main requirement:

I work in the localization industry and GUIautomation is used extensively as often allyou need to do is ensure that your UI behavesand is correct with respect to the SourceUI. This is actually an easier job then fortesting the original source UI.

But most automation tools are based off of coordinates or text of thecontrols and these can change in the localized software. So my goal (though not yet implemented) is to allow scripts to run unchangedbetween original source language (often English) and the translatedsoftware (Japanese, German, etc).