Giter VIP home page Giter VIP logo

pywinauto's Introduction

Join the chat at https://gitter.im/pywinauto/pywinauto Documentation Status Windows Tests Linux Tests codecov.io Code Health Codacy Badge

pywinauto

pywinauto is a set of python modules to automate the Microsoft Windows GUI. At its simplest it allows you to send mouse and keyboard actions to windows dialogs and controls, but it has support for more complex actions like getting text data.

Supported technologies under the hood: Win32 API (backend="win32"; used by default), MS UI Automation (backend="uia"). User input emulation modules mouse and keyboard work on both Windows and Linux.

Setup

  • run pip install -U pywinauto (dependencies will be installed automatically)

Documentation / Help

Examples

It is simple and the resulting scripts are very readable. How simple?

from pywinauto.application import Application
app = Application().start("notepad.exe")

app.UntitledNotepad.menu_select("Help->About Notepad")
app.AboutNotepad.OK.click()
app.UntitledNotepad.Edit.type_keys("pywinauto Works!", with_spaces = True)

More detailed example for explorer.exe (using MS UI Automation):

from pywinauto import Desktop, Application

Application().start('explorer.exe "C:\\Program Files"')

# connect to another process spawned by explorer.exe
app = Application(backend="uia").connect(path="explorer.exe", title="Program Files")

app.ProgramFiles.set_focus()
common_files = app.ProgramFiles.ItemsView.get_item('Common Files')
common_files.right_click_input()
app.ContextMenu.Properties.invoke()

# this dialog is open in another process (Desktop object doesn't rely on any process id)
Properties = Desktop(backend='uia').Common_Files_Properties
Properties.print_control_identifiers()
Properties.Cancel.click()
Properties.wait_not('visible') # make sure the dialog is closed

Dependencies (if install manually)

  • Windows:
  • Linux:
  • Optional packages:
    • Install Pillow (by pip install -U Pillow) to be able to call capture_as_image() method for making a control's snapshot.

Packages required for running unit tests

Run all the tests: python ./pywinauto/unittests/testall.py

Contribution

Pull requests are very welcome. Read Contribution Guide for more details about unit tests, coding conventions, etc.

Copyrights

Pywinauto for native Windows GUI was initially written by Mark Mc Mahon. Mark brought many great ideas into the life using power of Python. Further contributors are inspired of the nice API so that the development continues.

Starting from 0.6.0 pywinauto is distributed under the BSD 3-clause license. Pywinauto 0.5.4 and before was distributed under the LGPL v2.1 or later.

  • (c) The Open Source Community, 2015-2017 (0.6.0+ development)
  • (c) Intel Corporation, 2015 (led 0.5.x maintenance)
  • (c) Michael Herrmann, 2012-2013 (0.4.2)
  • (c) Mark Mc Mahon, 2006-2010 (0.4.0 and before)

pywinauto's People

Contributors

a-zotov avatar airelil avatar akarsakov avatar alexandermyasnikov avatar antonlarin avatar artemyskrebkov avatar asyapronina avatar batterseapower avatar blinkovaekaterina avatar cetygamer avatar daniil-kukushkin avatar dmitry-abramov avatar dmitrykazanbaev avatar efremovd avatar egorsharov avatar ethanhs avatar funkyhat avatar ivanmagazinnik avatar moden-py avatar msamokhvalov avatar nikita-k avatar nikkrasn avatar okainov avatar skachkova-natalia avatar sovrasov avatar syainova-diana avatar vasily-v-ryabov avatar viktorroy94 avatar vvillwin avatar yusipovigor avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.