How to click on telegram contacts menu with Pywinauto

I want to click on the contacts menu in a telegram with Pywinauto. I ran this code but had an error:

>>> import pywinauto
>>> from pywinauto.application import Application
>>> app = Application.start ("C:\Users\Ali\AppData\Roaming\Telegram Desktop\Telegram.exe")
>>> app.Telegram.MenuSelect ("Contacts")

Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    app.Telegram.MenuSelect ("Contacts")
  File "C:\Python27\lib\site-packages\pywinauto-0.5.1-py2.7.egg\pywinauto\application.py", line 244, in __getattr__
    ctrls = _resolve_control(self.criteria)
  File "C:\Python27\lib\site-packages\pywinauto-0.5.1-py2.7.egg\pywinauto\application.py", line 807, in _resolve_control
    raise e.original_exception
MatchError: Could not find 'Telegram' in '[]'
>>> 

How can I do this script? Answer me "I need it." Thank.

+1
source share

Source: https://habr.com/ru/post/1658755/


All Articles