Giter Site home page Giter Site logo

pywinauto / pywinauto Goto Github PK

View Code? Open in Web Editor NEW
4.6K 166.0 663.0 25.77 MB

Windows GUI Automation with Python (based on text properties)

Home Page: http://pywinauto.github.io/

License: BSD 3-Clause "New" or "Revised" License

Batchfile 0.07% Python 99.50% PowerShell 0.27% XSLT 0.16%
python automation ui-automation ui-automated-tests windows pywinauto linux gui user-interface testing-tools

pywinauto's Introduction

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

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.

Enjoying this?

Just star the repo or make a donation.

paypal

Your help is valuable since this is a hobby project for all of us: we do new features development during out-of-office hours.

  • In general the library tends to be cross-platform in the near future (Linux in 2018, macOS in 2019).
  • Reliable text based "record-replay" generator is also a high priority feature under development.
  • More feature requests and discusions are welcome in the issues.

Setup

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

Documentation / Help

Simple Example

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)

MS UI Automation Example

More detailed example for explorer.exe:

from pywinauto import Desktop, Application

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

# connect to another process spawned by explorer.exe
# Note: make sure the script is running as Administrator!
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-2018 (0.6.0+ development)
  • (c) Intel Corporation, 2015 (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

airelil avatar aleksandrpanov avatar artemyskrebkov avatar asyapronina avatar blinkovaekaterina avatar cetygamer avatar cristifati avatar dmitrykazanbaev avatar drinkertea avatar efremovd avatar egorsharov avatar eltimen avatar eokruglov avatar ivanmagazinnik avatar kimnikita avatar moden-py avatar morphine43 avatar msamokhvalov avatar nebyt avatar nikita-k avatar nikkrasn avatar okainov avatar radaevvalentin avatar skachkova-natalia avatar sovrasov avatar syainova-diana avatar vasily-v-ryabov avatar viktorroy94 avatar vvillwin avatar yusipovigor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pywinauto's Issues

TreeViewWrapper.Select sends TVM_SELECTITEM successfully, but item is not selected

From @vasily-v-ryabov on April 6, 2015 13:42

Code for reproduce:

from __future__ import print_function
import sys, os

os.chdir(os.path.join(os.getcwd(), os.path.dirname(sys.argv[0])))
import pywinauto

if pywinauto.sysinfo.is_x64_Python():
    app = pywinauto.Application().start_(r'.\controlspy0998\x64\Tree View.exe')
else:
    app = pywinauto.Application().start_(r'.\controlspy0998\Tree View.exe')
print('started')
tree = app.MicrosoftControlSpy.TreeView.WrapperObject()
print('connected')

tree.Select((0, 1, 2))

#pywinauto.win32functions.SendMessage(tree, pywinauto.win32defines.TVM_SELECTITEM, pywinauto.win32defines.TVGN_CARET, tree.GetItem((0, 1, 2)).elem)

Copied from original issue: vasily-v-ryabov/pywinauto-64#15

Testcases depend on missing files

some unittests try to start missing exe files
e.g.
C:\_projects\py_pywinauto\controlspy0798\\Status bar.exe
C:\_projects\py_pywinauto\controlspy0798\\Tab.exe
C:\_projects\py_pywinauto\controlspy0798\\List View.exe
C:\_projects\py_pywinauto\controlspy0798\\rebar.exe

From error report:
======================================================================
ERROR: testColumn (test_common_controls.ListViewTestCases)
Test the ListView Columns method
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Workspace\pywinauto-0.4.0\pywinauto\unittests\test_common_controls.py", line 65, in setUp
    app.start_(controlspy_folder + "List View.exe")
  File ".\pywinauto\application.py", line 876, in start_
    raise AppStartError(message)
AppStartError: Could not create the process 
"C:\_projects\py_pywinauto\controlspy0798\\List View.exe"
Error returned by CreateProcess: [Error 2] Den angivne fil blev ikke fundet.

Original issue reported on code.google.com by [email protected] on 26 Jan 2013 at 5:49

Add pypiwin32 to setup.py

Probably we need to add pypiwin32 dependency into setup.py to make pyWin32 dependency installed automatically by pip install pywinauto.

Restrictions: pypiwin32 supports Py2.7, Py3.1 - Py3.4. It doesn't support Py2.6. So need to add this to installation instructions.

DragMouse is not working

What steps will reproduce the problem?
1. Testing dragmouse feature on notepad.
2. Not able to select the text

What is the expected output? What do you see instead?
A piece of test has to be selected

What version of the product are you using? On what operating system?
pywinauto0-4-2

Please provide any additional information below.

Am working on automating a GUI application, where i want to drag mouse to 
select a window  .But its not working.Hence, I tried the same on a notepad 
application,which in turn failed.

Original issue reported on code.google.com by [email protected] on 10 Mar 2014 at 10:07

pywinauto - Installation issues

Import error - pywinauto package is not updated in site-packages folder (i.e. 
c:\Python27\lib\site-packages\pywinauto).

What steps will reproduce the problem?
1. Installed Python 2.7 
2. Downloaded pywinauto-0.4.0 from sourceforge 
For more info on steps followed: 
http://pywinauto.pbworks.com/w/page/9546218/Installation

What is the expected output? What do you see instead?
pywinauto packages are expected to be in python -> lib -> site-packages.

What version of the product are you using? On what operating system?
Python 2.7
pywinauto-0.4.0

Original issue reported on code.google.com by [email protected] on 19 Mar 2013 at 5:55

WPF Support

I'm having trouble working with a wpf-application. I manage to connect to the 
program and draw an outline. But I don't manage to find any ControlIdentifiers. 
All I get is the heading "Control Identifires:" and then nothing mote.

Do pywinauto support wpf, or just winforms? And if it only supports winforms, 
are there any plans to support wpf?

What version of the product are you using? On what operating system?
pywinauto 0.4.0.0, Windows 7 x64, .Net 4.0, 


Original issue reported on code.google.com by [email protected] on 10 Jan 2011 at 12:40

Implement keyboard and mouse hooks module (say hooks.py)

pyHook contains C module. But hooks can be implemented with Python only (using ctypes).

See pyHook example for reference: http://stackoverflow.com/questions/4581772/using-pyhook-to-respond-to-key-combination-not-just-single-keystrokes

One more example of keyboard hook without pyHook: http://stackoverflow.com/questions/9817531/applying-low-level-keyboard-hooks-with-python-and-setwindowshookexa

Analogue in AutoIt:

HotKeySet('{F2}', '_hk1')

While 1
Sleep(100)
WEnd

Func _hk1()
Send("{CTRLDOWN}{SHIFTDOWN}t{SHIFTUP}{CTRLUP}")
EndFunc

Thanks TomashUA for the use case.

Python2.5 ใ€€ImportError: No module named elementtree.ElementTree

Hi Mark

Please acknowledge it though it might be likely to be impolite because it is 
not good at English.

WriteToXML() & XMLHelpers.py() I try.
but Run result ImportError: No module named elementtree.ElementTree.

I read XMLHelpers src.

โ†“this module import is pthon 2.4 under
from elementtree.ElementTree import Element, SubElement, ElementTree
from cElementTree import Element, SubElement, ElementTree

but python 2.5 higher
from xml.etree.ElementTree import Element, SubElement, , ElementTree
from xml.etree.cElementTree import Element, SubElement, ElementTree

not Python 2.5?

Will you consider python 2.5?

Please say they might be able to be some cooperation.

Thank you.
Dai

---
Transferred from openqa JIRA
Resolution:     Fixed
Reporter:   Daisuke Yamashita


Original issue reported on code.google.com by [email protected] on 26 Aug 2010 at 2:22

How to access the application menu, if it's name has spaces in it ?

What steps will reproduce the problem?
1.Open any application whose dialogue box title, has spaces in it's name 
2.Then try to access the menu using it's name 
3.After that error will pop up  

What is the expected output? What do you see instead?
I'm expecting to access the menu item, but it' not able to access


What version of the product are you using? On what operating system?
pywinauto-0.4.2 with Python 2.7 on Windows 7

Please provide any additional information below.

1.I have an application called 'Syntext Serna' xml editor. 
2.I'm able to open up the application, but when I try to access it's Menu, it's 
giving me error like this:

Traceback (most recent call last):
  File "test.py", line 4, in <module>
    app.dlg.MenuSelect("Document->Open")
  File "c:\python27\lib\site-packages\pywinauto\application.py", line 238, in __getattr__
    ctrls = _resolve_control(self.criteria)
  File "c:\python27\lib\site-packages\pywinauto\application.py", line 795, in _resolve_control
    raise e.original_exception
pywinauto.findbestmatch.MatchError: Could not find 'dlg' in '[u'Syntext Serna 
Free 4.2.0-20091009QWidget', u'QWidget', u'Syntext Serna Free 4.2.0-20091009']'

My code:
from pywinauto import application
app = application.Application.start(r"C:\Program Files\Syntext\Serna Free 
4.2\bin\serna.exe")
dlg = "Syntext Serna Free 4.2.0-20091009"
app.dlg.MenuSelect("Document->Open")


I believe the main reason behind this is, the application name has spaces in 
between. Is there any workaround for this ?

Original issue reported on code.google.com by [email protected] on 15 Oct 2014 at 4:49

_treeview_element.Click() uses ClickInput()

What steps will reproduce the problem?
1. In common_control.py class _treeview_element contain method Click
2. Method Click uses another method HwndWrapper.ClickInput
3. It is inconsistent, HwndWrapper has Click and ClickInput methods and they 
works in different way.

What is the expected output? What do you see instead?
The _treeview_element.Click() should use HwndWrapper.Click()
Probably _treeview_element.ClickInput()should be added.

What version of the product are you using? On what operating system?
0.4.1. In 0.4.2 I saw the same issue

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 5 Feb 2014 at 8:01

XMLHelpers.py doesn't work on Python 3.3: unknown encoding: bz2

Traceback (most recent call last):
  File "C:\projects\pywinauto-8b7t7\pywinauto\unittests\test_win32controls.py", line 484, in setUp
    self.app.Calculator.WriteToXML("ref_controls.xml")
  File "C:\projects\pywinauto-8b7t7\pywinauto\controls\win32_controls.py", line 872, in WriteToXML
    XMLHelpers.WriteDialogToFile(filename, props)
  File "C:\projects\pywinauto-8b7t7\pywinauto\XMLHelpers.py", line 171, in WriteDialogToFile
    _SetNodeProps(ctrlelem, name, value)
  File "C:\projects\pywinauto-8b7t7\pywinauto\XMLHelpers.py", line 111, in _SetNodeProps
    image_data = codecs.encode(codecs.encode(value.tobytes(), "bz2"), "base64").decode('utf-8')
LookupError: unknown encoding: bz2

TreeView manipulate problem

From @HaveF on January 11, 2015 7:34

I try to manipulate TreeView, but it seem have problem in it:

like this te.GetProperties():

---------------------------------------------------------------------------
WindowsError                              Traceback (most recent call last)
<ipython-input-46-ff3d1ddba23e> in <module>()
----> 1 te.GetProperties()

C:\Anaconda\lib\site-packages\pywinauto\controls\common_controls.pyc in GetProperties(self)
    900     def GetProperties(self):
    901         "Get the properties for the control as a dictionary"
--> 902         props = super(TreeViewWrapper, self).GetProperties()
    903 
    904         props['ItemCount'] = self.ItemCount()

C:\Anaconda\lib\site-packages\pywinauto\controls\HwndWrapper.pyc in GetProperties(self)
    756         for propname in self.writable_props:
    757             # set the item in the props dictionary keyed on the propname
--> 758             props[propname] = getattr(self, propname)()
    759 
    760         if self._NeedsImageProp:

C:\Anaconda\lib\site-packages\pywinauto\controls\common_controls.pyc in Texts(self)
    864         texts = [self.WindowText(), ]
    865         if self.ItemCount():
--> 866             texts.append(self.Root().Text())
    867             elements = self.Root().SubElements()
    868 

C:\Anaconda\lib\site-packages\pywinauto\controls\common_controls.pyc in Text(self)
    519     def Text(self):
    520         "Return the text of the item"
--> 521         return self._readitem()[1]
    522 
    523     #----------------------------------------------------------------

C:\Anaconda\lib\site-packages\pywinauto\controls\common_controls.pyc in _readitem(self)
    835 
    836             # seems that this may not always be correct
--> 837             raise ctypes.WinError()
    838 
    839         return item, text
WindowsError: [Error 0] ๆ“ไฝœๆˆๅŠŸๅฎŒๆˆใ€‚

After a search, it seem this problem is brought by this commit.

Do you have any idea about this? ๐Ÿ˜„

Thanks!

Copied from original issue: vasily-v-ryabov/pywinauto-64#1

pip install pywinauto installs ancient version

C:\Users\zz>pip install pywinauto
Downloading/unpacking pywinauto
  Downloading pywinauto-0.1.3.zip (236Kb): 236Kb downloaded
  Running setup.py egg_info for package pywinauto

Installing collected packages: pywinauto
  Running setup.py install for pywinauto

Successfully installed pywinauto
Cleaning up...

C:\Users\zz>pip uninstall pywinauto
Uninstalling pywinauto:
  c:\python27\lib\site-packages\pywinauto
  c:\python27\lib\site-packages\pywinauto-0.1.3-py2.7.egg-info
Proceed (y/n)? y
  Successfully uninstalled pywinauto


C:\Users\zz>pip install hg+https://code.google.com/p/pywinauto
Downloading/unpacking hg+https://code.google.com/p/pywinauto
  Cloning hg https://code.google.com/p/pywinauto to c:\users\zz\appdata\local\temp\pip-ogdgm1-build
  Running setup.py egg_info for package from hg+https://code.google.com/p/pywinauto

    warning: no files found matching 'dev_notes.txt'
    warning: no files found matching 'HISTORY.TXT'
    warning: no files found matching 'TODO.txt'
    warning: no files found matching 'pywinauto'
    warning: no previously-included files found matching 'pywinauto\.svn\*'
    warning: no files found matching 'pywinauto\examples\*.pkl'
    warning: no files found matching 'examples\*.txt'
    warning: no previously-included files found matching 'examples\.svn\README.txt'
    warning: no files found matching 'docs\*.*'
    warning: no previously-included files found matching 'docs\.svn\*'
    warning: no previously-included files found matching 'docs\pywinauto\.svn\*'
    warning: no previously-included files found matching 'docs\pywinauto\controls\.svn\*'
    warning: no previously-included files found matching 'docs\pywinauto\tests\.svn\*'
    warning: no previously-included files found matching 'docs\.doctrees\*'
Installing collected packages: pywinauto
  Running setup.py install for pywinauto

    warning: no files found matching 'dev_notes.txt'
    warning: no files found matching 'HISTORY.TXT'
    warning: no files found matching 'TODO.txt'
    warning: no files found matching 'pywinauto'
    warning: no previously-included files found matching 'pywinauto\.svn\*'
    warning: no files found matching 'pywinauto\examples\*.pkl'
    warning: no files found matching 'examples\*.txt'
    warning: no previously-included files found matching 'examples\.svn\README.txt'
    warning: no files found matching 'docs\*.*'
    warning: no previously-included files found matching 'docs\.svn\*'
    warning: no previously-included files found matching 'docs\pywinauto\.svn\*'
    warning: no previously-included files found matching 'docs\pywinauto\controls\.svn\*'
    warning: no previously-included files found matching 'docs\pywinauto\tests\.svn\*'
    warning: no previously-included files found matching 'docs\.doctrees\*'
Successfully installed pywinauto
Cleaning up...

C:\Users\zz>

Original issue reported on code.google.com by [email protected] on 8 Feb 2012 at 7:52

patch for restoring winNT compatibility

What steps will reproduce the problem?
1. winNT isn't supported any more since version 0.2.5~ish because GetMenuInfo 
isn't supported there but the symbol is unconditionally read in the 
win32function.py file

What is the expected output? What do you see instead?

I expected that "python setup.py build" was finishing normally, but instead, it 
crashed on 
AttributeError: function 'GetMenuInfo' not found

What version of the product are you using? On what operating system?
pywinauto 0.2.5+ (tried many up to 0.4.2 included) on WindowsNT sp6

Please provide any additional information below.
The attached patch silently discard this attribute error and let pywinauto run 
with just this symbol muted

Original issue reported on code.google.com by [email protected] on 9 Feb 2015 at 12:56

Attachments:

Unit test test_application.py did not pass on pywinauto-0.4.0 (Japanese Windows)

What steps will reproduce the problem?
1. Set up (install Python 3.4, pywinauto-0.4.0 on Windows 7; fix source code to 
let the code be Python 3.4 compatible; set PYTHONPATH)
2. Browse to pywinauto-0.4.0\pywinauto\unittests
3. Run "python test_application.py"


What is the expected output? What do you see instead?

The unit tests passed.  However, the test didn't seem to let the application 
menu recognize menu selection, such as (MenuSelect("File->Exit")).  Below shows 
a part of the unit test log messages

======================================================================
ERROR: test__init__ (__main__.WindowSpecificationTestCases)
Test creating a new spec by hand
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_application.py", line 417, in tearDown
    self.app.UntitledNotepad.MenuSelect("File->Exit")
  File "C:\pywinauto-0.4.0\pywinauto\controls\HwndWrapper.py", line 1195, in MenuSelect
    self.MenuItem(path).Select()
  File "C:\pywinauto-0.4.0\pywinauto\controls\HwndWrapper.py", line 1145, in MenuItem
    return self.Menu().GetMenuPath(path, appdata = menu_appdata)[-1]
  File "C:\pywinauto-0.4.0\pywinauto\controls\menuwrapper.py", line 418, in GetMenuPath
    item_texts = [item.Text() for item in self.Items()]
  File "C:\pywinauto-0.4.0\pywinauto\controls\menuwrapper.py", line 418, in <listcomp>
    item_texts = [item.Text() for item in self.Items()]
  File "C:\pywinauto-0.4.0\pywinauto\controls\menuwrapper.py", line 138, in Text
    info = self._read_item()
  File "C:\pywinauto-0.4.0\pywinauto\controls\menuwrapper.py", line 90, in _read_item
    raise ctypes.WinError()
OSError: [WinError 87] ใƒ‘ใƒฉใƒกใƒผใ‚ฟใƒผใŒ้–“้•ใฃใฆใ„ใพใ™ใ€‚


What version of the product are you using? On what operating system?

pywinauto-0.4.0, Windows 7


Please provide any additional information below.

The OS was Japanese (64-bit) one, so part of the error messages contained 
Japanese characters.

Original issue reported on code.google.com by [email protected] on 23 May 2014 at 4:34

Why HwnWrapper.GetProperties retun Dict ??

Hi Mark!!

thank you reply issue 1.

I try XMLHelper and it could use.

Please Teache me Quession.

XMLHelpers.WriteDialogToFile(filename, props )

props = must be type list.(ex [ { 'UserData', :0 } ]

example

#1
app.notepad.Menu().GetProperties() is return list.

but

#2
app.notepad.GetProperties() is retun dict

so, list = [dict ]

Why GetProperties retrun is dict Tyep?
Please teach the reason. and You have made a mistake the how and understanding 
my to use?

Dai

---
Issue transferred from OpenQa
Status:     Open Open
Assignee:   Mark Mc Mahon
Reporter:   Daisuke Yamashita

Original issue reported on code.google.com by [email protected] on 26 Aug 2010 at 2:24

pip 1.5.6 comatibility: do not import pyWin32 modules and pywinauto itself in setup.py

For compatibility with old pip (say pip 1.5.6, default in ActivePython), we do not need to import pyWin32 modules in setup.py.

Downloading/unpacking pywinauto
  Running setup.py (path:c:\users\<username>\appdata\local\temp\pip_build_<username>
\pywinauto\setup.py) egg_info for package pywinauto
    No ez_setup.py. Using plain setuptools...

    warning: no files found matching 'Readme.txt'
    warning: no previously-included files found matching 'examples\examples_wats
up\*.py'
    warning: no previously-included files found matching 'pywinauto\docs\.doctre
es\*'
    The following module has to be installed before running pywinauto...
        win32gui
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "c:\users\<username>\appdata\local\temp\pip_build_<username>\pywinauto\se
tup.py", line 118, in <module>
        raise Exception('installation failed: ' + str(e))
    Exception: installation failed: No module named win32gui
    Complete output from command python setup.py egg_info:
    No ez_setup.py. Using plain setuptools...

running egg_info

creating pip-egg-info\pywinauto.egg-info

writing requirements to pip-egg-info\pywinauto.egg-info\requires.txt

writing pip-egg-info\pywinauto.egg-info\PKG-INFO

writing top-level names to pip-egg-info\pywinauto.egg-info\top_level.txt

writing dependency_links to pip-egg-info\pywinauto.egg-info\dependency_links.txt


writing manifest file 'pip-egg-info\pywinauto.egg-info\SOURCES.txt'

warning: manifest_maker: standard file '-c' not found



reading manifest file 'pip-egg-info\pywinauto.egg-info\SOURCES.txt'

reading manifest template 'MANIFEST.in'

warning: no files found matching 'Readme.txt'

warning: no previously-included files found matching 'examples\examples_watsup\*
.py'

warning: no previously-included files found matching 'pywinauto\docs\.doctrees\*
'

writing manifest file 'pip-egg-info\pywinauto.egg-info\SOURCES.txt'

The following module has to be installed before running pywinauto...

        win32gui

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "c:\users\<username>\appdata\local\temp\pip_build_<username>\pywinauto\setup.
py", line 118, in <module>

    raise Exception('installation failed: ' + str(e))

Exception: installation failed: No module named win32gui

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in c:\users\<username>\a
ppdata\local\temp\pip_build_<username>\pywinauto
Storing debug log for failure in C:\Users\<username>\pip\pip.log

Older versions of pywinauto

Hi,

I'm trying to adapt pywinauto into one of projects but i have a little concern 
about your release policy. Does release of new version means that older 
packages will be deleted from download?

I've created setup.py with requirement 'pywinauto==0.4.1' which isn't valid 
anymore and because only 0.4.2 version is available.

Original issue reported on code.google.com by [email protected] on 17 Sep 2013 at 10:50

Syntax Error: Missing parentheses in call to 'print' while installing

ะญั‚ะพ ะฟั€ะพัั‚ะพ ะธะท-ะทะฐ ั‚ะพะณะพ, ั‡ั‚ะพ ะฒ python3 ะฝะฐะดะพ ะฒั‹ะฟะพะปะฝัั‚ัŒ ั„ัƒะฝะบั†ะธัŽ print ะขะžะ›ะฌะšะž ัะพ ัะบะพะฑะบะฐะผะธ, ัะดะตะปะฐะน ั„ะธะบั)
P.S.:line 121
UPD: ะญั‚ะพ ะพัˆะธะฑะบะฐ ะฒ pywin32 setup.py!, ะธะทะฒะธะฝััŽััŒ

automation stops

What steps will reproduce the problem?
1. mouse movements
2. keyboard typing 
3.

What is the expected output? What do you see instead?
I want to able to use my pc while running the automation.


What version of the product are you using? On what operating system?
I'm uing windows 7 enterprise 64bit, python 2.7.5

Please provide any additional information below.

I'm using pywinauto for my python automation, I have finished my automation but 
while the automation is runnign I cant use the mouse or the keyboard to do 
something else, the automation just stops.


Original issue reported on code.google.com by [email protected] on 21 Nov 2013 at 2:17

If program launches another exe as a blocking call, you can't connect to the new process

What steps will reproduce the problem?
1. Run a program that runs another exe and waits for it to return
2. Try to app.Connect(process = xxx) to the new process
3. It shows a different handle, but when searching for controls it appears to 
be looking only at the original window. 

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?
Windows 2003, python 2.6, pywinauto-0.4.0

Please provide any additional information below.
I also tried doing top_window_() but got the same results.  Basically I really 
like your implementation, but our installer calls our config wizard to 
configure the product along the way, and it appears that I cannot then connect 
to the config wizard process.  

Original issue reported on code.google.com by [email protected] on 13 Apr 2011 at 12:55

Attachments:

It's impossible to type a closing curly brace

What steps will reproduce the problem?

TypeKeys('{}}'). According to the documentation of SendKeys, this should type a 
closing curly brace '}'. However, SendKeys doesn't recognize that the closing 
curly brace in the middle of '{}}' is escaped and raises "RuntimeError: Unknown 
code:". 

What is the expected output? What do you see instead?

The expected output is that the HwndWrapper on which TypeKeys is called 
receives the key combination for a curly brace. Instead, a RuntimeError is 
raised by SendKeysCtypes. 

What version of the product are you using? On what operating system?

pywinauto-0.4.0, Python 2.7.3 on Windows 7 32 bit. 

Please provide any additional information below.

The bug is easy to spot in SendKeysCtypes.py. I can provide a patch if needed. 

Original issue reported on code.google.com by [email protected] on 24 Jul 2012 at 6:49

Finding SendKeys Module

What steps will reproduce the problem?
1. Downloading version 0.4.0
2. setup.py install



I'm using Win8 64 bit.
I know I need the SendKey dependency but I can't resolve it, do you know where 
the code for that dependency is ?

Original issue reported on code.google.com by [email protected] on 4 Mar 2014 at 3:20

split PrintControlIdentifiers method

Hello!

Propose improvements: split function `PrintControlIdentifiers` into two 
functions:
1. GetControlIdentifiers - for collect information about controls and
2. PrintControlIdentifiers - for output collected info.

Also, in PrintControlIdentifiers method this patch consist:
1. It is now possible to determine the output encoding (by default is system 
console encoding).
2. Fix console pipeline output bug.

Yours
Mikhail.

Original issue reported on code.google.com by [email protected] on 19 Dec 2011 at 5:46

Attachments:

TypeKeys doesn't work for GTK controls. Alphanumeric chars are not typed.

What steps will reproduce the problem?
1. Use some GTK controls. I used Open file dialog in MonoDevelop
2. Assume cursor is in the path editbox. Editbox text contain "zxxy". Cursor is 
between z and x.
3. do mydlg.TypeKeys("{RIGHT}a+bc{RIGHT}")

What is the expected output? What do you see instead?
Editbox text now contain "zxBxy", cursor is between x and y. Chars a and c were 
not typed in.

What version of the product are you using? On what operating system?
Python 2.7 win/x86
Win7 Home Premium x64

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 13 Feb 2013 at 12:44

Sometimes there is no effect of Expand() execution

What steps will reproduce the problem?
1. I browse through treeview.
2. I try to expand every element. Every, because I can't check if tree element 
is expandable or not.
3. Sometimes 1 or 2 (sometimes more) elements are not expanded.

What is the expected output? What do you see instead?
I want to have expanded every element which I used Expand() on. Now sometimes 
elements ora not expended and I don't have info bout it.

What version of the product are you using? On what operating system?
pywinauto 0.4.0
Python 2.7.3
Windows 7 64-bit

Original issue reported on code.google.com by [email protected] on 7 Nov 2012 at 1:23

Attachments:

Add something like DoActionUntil() to make things stable

Sometimes window messages and mouse/keyboard actions are not really handled by test application because of short non-responding state or another reason.

We need to introduce some stabilization feature for such cases. Unstable code:

taskbar.Clock.ClickInput()
ClockWindow = taskbar.explorer_app.Window_(class_name='ClockFlyoutWindow')
ClockWindow.Wait('visible') # WindowNotFound exception may be raised here from time to time

Stable modification proposal (ideally we should simply wrap unstable code with stabilizer):

ClockWindow = taskbar.explorer_app.Window_(class_name='ClockFlyoutWindow')
DoActionUntil(
    taskbar.Clock.ClickInput(),
    ClockWindow.Wait('visible')
)

Let's discuss how it can be done. ;)

taskbar.ClickSystemTrayIcon(0) throws exception on non english OS

taskbar.ClickSystemTrayIcon(0)

What is the expected output? What do you see instead?
I wanted to see a left mouse click on the 1st icon on the system tray

What version of the product are you using? On what operating system?
I'm using pywinauto-0.4.0 on Windows Xp

Please provide any additional information below.

taskbar.ClickSystemTrayIcon(0)
throws the following exception,
Traceback (most recent call last):
  File "Run_Updater.py", line 452, in <module>
  File "pywinauto\taskbar.pyc", line 52, in ClickSystemTrayIcon
  File "pywinauto\taskbar.pyc", line 41, in _get_visible_button_index
  File "pywinauto\application.pyc", line 229, in __getattr__
  File "pywinauto\application.pyc", line 788, in _resolve_control
pywinauto.findbestmatch.MatchError: Could not find 'NoficationArea' in '['', u'C
iceroUIWndFrame', u'Programmer, der k\xf8rer1', u'Programmer, der k\xf8rer0', u'
08:12TrayClockWClass', u'Programmer, der k\xf8rer2', u'MSTaskSwWClass', u'MSN To
olbarToolbar', u'startEdit', u'08:12', u'TF_FloatingLangBar_WndTitle', u'Program
mer, der k\xf8rerToolbar', u'TrayClockWClass', u'Programmer, der k\xf8rerMSTaskS
wWClass', u'startWinDeskbarGhost', u'start', 'ComboBox', u'TrayNotifyWnd', u'Pro
grammer, der k\xf8rer', '1', '0', '3', '2', 'Edit', u'startComboBox', u'startCom
boBoxEx', 'Pager', 'Toolbar', 'ComboBoxEx', u'Proceslinje', 'ReBar', u'MSN Toolb
ar', 'Button', 'Toolbar3', 'Button2', 'Button1', 'Button0', 'Toolbar0', u'TF_Flo
atingLangBar_WndTitleCiceroUIWndFrame', u'WinDeskbarGhost', 'Toolbar2', 'Toolbar
1', u'ComboLBox', u'startButton', u'startReBar', u'ProceslinjeToolbar', u'startC
omboLBox']'

Original issue reported on code.google.com by [email protected] on 2 Aug 2011 at 3:19

Project being used in commercial software

Hi, Im not perfectly sure but it looks like those guys are selling "pywinauto" 
under another name.
http://www.getautoma.com/

If im wrong (or as a matter of fact that behaviour is rightful) I deeply 
apologize, but their video is exactly same as the video in pywinauto home and 
sincerely I love pywinauto enough as not to want it to go comercial and 
licensed so I couldnt use it in my free open source projects.

Thank you.

Original issue reported on code.google.com by [email protected] on 23 Apr 2013 at 8:45

No download links for pywinauto releases on Google Code site

If you search the web for pywinauto, the first hit is the Google Code site.  
However, that site apparently has no links to actually download a release of 
pywinauto.  The best you can do is get it from git.  (Eventually I was able to 
find a release by going to SourceForge.)  I think it would be very helpful to 
users to either provide downloads or download links directly from the Google 
Code site.

Original issue reported on code.google.com by [email protected] on 8 Jul 2011 at 4:41

handleprops.py patch

What steps will reproduce the problem?
1. apparently creating some "Window not Found" errors

What is the expected output? What do you see instead?
ctypes error at line 58:
        buffer_ = ctypes.create_unicode_buffer(length)


What version of the product are you using? On what operating system?
0.4.0 Win7 32bit

Please provide any additional information below.
In handleprops.py I had to change

    if length:
to
    if length>=0:
as length.value returned negative values in some error cases.

Original issue reported on code.google.com by [email protected] on 3 Apr 2015 at 5:02

Issue when using pywinauto and cxfreeze

Hi,

I'm trying to make my pywinauto script into an .exe. I recieved this error even though "pywinauto.tests.allcontrols" is included in my setup.py packages.

Traceback (most recent call last):
  File "C:\WinPython-64bit-3.4.2.3\python-3.4.2.amd64\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in <module>
    exec(code, m.__dict__)
  File "backup.py", line 2, in <module>
  File "X:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
  File "X:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
  File "X:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
  File "X:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
  File "C:\WinPython-64bit-3.4.2.3\python-3.4.2.amd64\lib\site-packages\pywinauto\__init__.py", line 30, in <module>
    from . import findwindows
  File "X:\Python34\lib\importlib\_bootstrap.py", line 2284, in _handle_fromlist
  File "X:\Python34\lib\importlib\_bootstrap.py", line 321, in _call_with_frames_removed
  File "X:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
  File "X:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
  File "X:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
  File "X:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
  File "C:\WinPython-64bit-3.4.2.3\python-3.4.2.amd64\lib\site-packages\pywinauto\findwindows.py", line 38, in <module>
    from . import controls
  File "X:\Python34\lib\importlib\_bootstrap.py", line 2284, in _handle_fromlist
  File "X:\Python34\lib\importlib\_bootstrap.py", line 321, in _call_with_frames_removed
  File "X:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
  File "X:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
  File "X:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
  File "X:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
  File "C:\WinPython-64bit-3.4.2.3\python-3.4.2.amd64\lib\site-packages\pywinauto\controls\__init__.py", line 34, in <module>
    from . import win32_controls
  File "X:\Python34\lib\importlib\_bootstrap.py", line 2284, in _handle_fromlist
  File "X:\Python34\lib\importlib\_bootstrap.py", line 321, in _call_with_frames_removed
  File "X:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
  File "X:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
  File "X:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
  File "X:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
  File "C:\WinPython-64bit-3.4.2.3\python-3.4.2.amd64\lib\site-packages\pywinauto\controls\win32_controls.py", line 43, in <module>
    from .. import tests
  File "X:\Python34\lib\importlib\_bootstrap.py", line 2284, in _handle_fromlist
  File "X:\Python34\lib\importlib\_bootstrap.py", line 321, in _call_with_frames_removed
  File "X:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
  File "X:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
  File "X:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
  File "X:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
  File "C:\WinPython-64bit-3.4.2.3\python-3.4.2.amd64\lib\site-packages\pywinauto\tests\__init__.py", line 157, in <module>
    __init_tests()
  File "C:\WinPython-64bit-3.4.2.3\python-3.4.2.amd64\lib\site-packages\pywinauto\tests\__init__.py", line 141, in __init_tests
    test_module = __import__(test_name.lower(), globals(), locals(), level=1)
  File "X:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
  File "X:\Python34\lib\importlib\_bootstrap.py", line 2224, in _find_and_load_unlocked
ImportError: No module named 'pywinauto.tests.allcontrols'

I can't see new branch in tree if Timming is set to Slow

What steps will reproduce the problem?
1. I Set timings to slow
from pywinauto.timings import Timings
Timings.Slow()
2. later I try to expand element it tree view
BranchElem.Expand()
3. I can' see elements under

What is the expected output? What do you see instead?
I should see new branch under expanded element.
If I do not set timing to slow (leave default) it works correctly

What version of the product are you using? On what operating system?
pywinauto 0.4.0 on Windows 7 64-bit


Original issue reported on code.google.com by [email protected] on 31 Oct 2012 at 7:06

handleprops.text() can cause various issues, exceptions, freezes...

What steps will reproduce the problem?
1. for each window, call .text() on it
2. get lucky

-----------------------------------------
There are a few issues in handleprops.text() as it is written:

1. The return value of SendMessageTimeout is not checked.

If it returns 0, the function failed or the timeout occurred. The function 
should return '', or raise an exception. Currently, we ignore this possibility.

2. We try to allocate a unicode buffer of a length filled in by 
SendMessageTimeout. When SendMessageTimeout fails, it sometimes puts anything 
it wants in our variable. This has led to various exceptions, such as the 
length being negative, and various (temporary) system freezes, due to 
allocating what I imagine to be a few GB of RAM. Sometimes it directly bails 
with a MemoryError or an Overflow error.

-------------
Fix:

change:
win32functions.SendMessageTimeout(
to:
ret = win32functions.SendMessageTimeout(

add:
    if ret == 0:
        return '' #failed, probably timeout
after the function call

change:
    if length:
to:
    if length > 0:

Original issue reported on code.google.com by [email protected] on 8 Feb 2012 at 7:42

Unable to install pywinauto with python 3.3

What steps will reproduce the problem?
1. Downloaded and tried to install using command python setup.py install
2. first error was except syntax error, solved it and tried to install
3. Got Import error: No module named 'findwindows'

What is the expected output? What do you see instead?
Got Import error: No module named 'findwindows'

What version of the product are you using? On what operating system?
python 3.3, pywinauto version 0.4.2, Win 7 operating system

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 24 Dec 2014 at 9:11

not work with python 2.7/x64 on Win7/x64

What steps will reproduce the problem?
1. pip install pywinauto
2. in python shell:
>>> from pywinauto import application

Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    from pywinauto import application
  File "C:\Python27\lib\site-packages\pywinauto\application.py", line 64, in <module>
    import win32structures
  File "C:\Python27\lib\site-packages\pywinauto\win32structures.py", line 390, in <module>
    assert sizeof(MENUITEMINFOW) == 44, sizeof(MENUITEMINFOW)
AssertionError: 48

What version of the product are you using? On what operating system?

python 2.7/amd64.
Windows 7/x64

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 23 Aug 2012 at 8:47

DebugMessage throws exception

What steps will reproduce the problem?
1. np = Application().start_("notepad.exe").Notepad
2. np.DebugMessage("Hello, world!") 

What is the expected output? What do you see instead?
Expected output: "Hello, world!" written over the window
Actual output:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\pywinauto\controls\HwndWrapper.py", line 9
83, in DebugMessage
    ctypes.byref(rect),
TypeError: byref() argument must be a ctypes instance, not 'instancemethod'

What version of the product are you using? On what operating system?
0.4.2, Windows Server 2008 R2

Please provide any additional information below.
I've tried this for a few different windows on a couple different machines.  
Results do not vary.

Original issue reported on code.google.com by [email protected] on 27 Jun 2014 at 3:10

Method Click() performs right click at incorrect coordinates

This issue is moved from https://github.com/vasily-v-ryabov/pywinauto-64/issues/16

Code to reproduce (Win7 x64):

from __future__ import print_function
import sys, os

os.chdir(os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]))) #r'C:\<...>\pywinauto-64')
import pywinauto

explorer = pywinauto.Application().connect_(path='explorer.exe')
print('connected')
dlg = explorer.Window_(top_level_only=True, title='pywinauto-64', class_name='CabinetWClass')

tree = dlg.TreeView.WrapperObject()
for elem in tree.GetItem([1]).SubElements(): # desktop tree item sub-elements
    print(elem.Text())

dlg.SetFocus(); tree.GetItem((1,2,1)).Click(button='right')

Real click point is visible at popup menu location.

Not Found error on hyperlink to local documentation for class.pywinauto.controls

I'm trying to browse the pwinauto documentation locally (not connected to 
internet), but when I click on the link for any of the controls, I get a 
problem loading page error.

e.g.

File not found







          Firefox can't find the file at /L:/Downloads/Python/pywinauto-0.4.0/docs/class-pywinauto.controls.HwndWrapper.HwndWrapper.html#FriendlyClassName.



All other hyperlinks seem to work. It's just the links to the controls that I 
can't access. Online, the documentation on the web page is fine.

Thanks for any help

Original issue reported on code.google.com by [email protected] on 24 Jul 2012 at 7:24

support for .appref-ms apps?

What steps will reproduce the problem?
1. Attempt to start an app using start_ command, like 
app.start_('c:\foo\foo.appref-ms')

What is the expected output? What do you see instead?
app starts and app object references to Application's main window.

What version of the product are you using? On what operating system?
latest, on winXP

Please provide any additional information below.

command:

>>> app.start_ ('c:\Documents and 
Settings\navaoma\Desktop\Automation\Foo.appref-ms')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python25\lib\site-packages\pywinauto\application.py", line 876, in st
art_
    raise AppStartError(message)
pywinauto.application.AppStartError: Could not create the process "c:\Documents
and Settings
avaoma\Desktop\Automation\Foo.appref-ms"
Error returned by CreateProcess: [Error 2] The system cannot find the file speci
fied.
>>>


Original issue reported on code.google.com by [email protected] on 26 Nov 2012 at 7:10

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.