Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 17 13:07
    mkq10 commented #563
  • Jan 14 18:23
    EOKruglov synchronize #1162
  • Jan 14 18:19
    vectar7 opened #1170
  • Jan 13 11:57
    claell opened #1169
  • Jan 13 11:50
    claell commented #1167
  • Jan 12 20:13
    EOKruglov synchronize #1162
  • Jan 12 14:44
    claell commented #1168
  • Jan 12 14:42
    claell opened #1168
  • Jan 12 14:36
    claell opened #1167
  • Jan 12 11:33
    bananoviiblinchik commented #1166
  • Jan 12 05:06
    Avnsx edited #1166
  • Jan 12 05:06
    Avnsx opened #1166
  • Jan 09 13:48
    xjxflyxx edited #1165
  • Jan 09 13:43
    xjxflyxx opened #1165
  • Jan 06 09:28
    vasily-v-ryabov assigned #1087
  • Jan 05 08:25
    beeteekee commented #1096
  • Jan 04 06:25
    jiliguluss opened #1164
  • Jan 01 14:17
    codecov[bot] commented #1134
  • Jan 01 12:12
    vasily-v-ryabov commented #922
  • Jan 01 11:58
    vasily-v-ryabov commented #1025
amursa
@amursa
All i did id is to change main_window.MenuSelect('Setup->Securities & Parties->Securities').click() to this main_window.menu_select('Setup->Securities & Parties->Securities') and it worked.
Roman Isakov
@Xcqcr_gitlab

Здравствуйте, Василий.

Кажется, что print_control_identifiers() обходит далеко не все объекты, если backend='uia'

Например, Inspect.exe в режиме UI Automation находит гораздо больше "детей", когда print_control_identifiers() от основного окна находит только "родителя".

python:
[IN]
import pywinauto

a = pywinauto.application.Application(backend='uia')
a.connect(process=3936)
p = a.window()
p.print_control_identifiers()

[OUT]
Control Identifiers:

Dialog - '1С:Предприятие - ERP' (L551, T144, R1460, B764)
['1С:Предприятие - ERPDialog', 'Dialog', '1С:Предприятие - ERP']
child_window(title="1С:Предприятие - ERP", control_type="Window")

Хотя Inspect.exe от MS SDK показывает, что элементов целая уйма. Кнопок, тулбаров и пр
Roman Isakov
@Xcqcr_gitlab

Да, могу сказать, что print_control_identifiers() возвращает аналогичное количество значений, что и Inspect, если backend=win32

Но использовать backend=win32 вообще не мой вариант, ибо там нужно вручную каждый элемент искать (имена кривые, никак не ассоциировать)

1
Roman Isakov
@Xcqcr_gitlab
А, да, еще есть маленькое добавление - py_inspect, который Вы написали, отлично строит дерево. У меня есть подозрение, что print_control_identifiers(), которая относится к Application не эквивалентна перебору def __get_next(self, element_info, parent) в py_inspect.
Vasily Ryabov
@vasily-v-ryabov
Добрый день. Возможно, это известная проблема с неправильным пробросов флага visible_only=True, который глотает hidden элемент вместе с поддеревом, хотя в поддереве есть visible контролы. Вот ссылка на issue: pywinauto/pywinauto#596
К сожалению, в dump_tree / print_control_identifiers это не обойдёшь без фикса. А вот в .child_window() можно явно прописать visible_only=False. Несколько неудобно, но пока так.
Vasily Ryabov
@vasily-v-ryabov
Попробуем посмотреть и впихнуть в надвигающийся апдейт релиз 0.6.6.
_fantasticDev_
@SnakeGeneral
hello everyone~
app = Application(backend='uia')
app.start(r'../hello.net.exe')
in this case, i want to get the coordinate of the window.
please help me~~~
Vasily Ryabov
@vasily-v-ryabov
app.window(title=“Window Title”).rectangle() ?
_fantasticDev_
@SnakeGeneral
thank you sir
but i can't know the title
do you know Battle.net.exe?
@vasily-v-ryabov
shall i send you the source URL?
_fantasticDev_
@SnakeGeneral
@vasily-v-ryabov
hello sir

app = Application(backend='uia')
app.start(r'../Battle.net.exe')

time.sleep(1)
rect = app.window(title='Blizzard Battle.net Login').rectangle()

i receive a error message like this:::

C:\Users\Administrator\AppData\Local\Programs\Python\Python37\python.exe "C:/Program Files (x86)/Battle.net/Bot/AutoController.py"
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pywinauto\application.py", line 256, in __resolve_control
criteria)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pywinauto\timings.py", line 458, in wait_until_passes
raise err
pywinauto.timings.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:/Program Files (x86)/Battle.net/Bot/AutoController.py", line 20, in <module>
a = app.window(title='Blizzard Battle.net Login').rectangle()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pywinauto\application.py", line 378, in getattribute
ctrls = self.resolve_control(self.criteria)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pywinauto\application.py", line 259, in
resolve_control
raise e.original_exception
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pywinauto\timings.py", line 436, in wait_until_passes
func_val = func(args, *kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pywinauto\application.py", line 201, in __get_ctrl
dialog = self.backend.generic_wrapper_class(findwindows.find_element(
criteria[0]))
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pywinauto\findwindows.py", line 87, in find_element
raise ElementNotFoundError(kwargs)
pywinauto.findwindows.ElementNotFoundError: {'title': 'Blizzard Battle.net Login', 'backend': 'uia', 'process': 29520}

Process finished with exit code 1

Vasily Ryabov
@vasily-v-ryabov
@SnakeGeneral let’s start from app.windows() then. Try method .window_text() for every wrapper object returned in a list of app.windows().
_fantasticDev_
@SnakeGeneral
yes
thank you sir
Vasily Ryabov
@vasily-v-ryabov
Login window might be a child of another top level window. It’s typical situation for “uia” backend.
_fantasticDev_
@SnakeGeneral
yes
much thanks.
prolorenzo
@suicide1111

Hello, I have error, can U help me?

def tab1_check(self):
app3 = Application()
app3.start(tab1_path_to_sitelink)
global tab1_connect
tab1_connect = app3.process
print(tab1_connect)
self.tab1_sod()

def tab1_sod(self):
try:
app2 = Application(backend="uia").connect(process=f'{tab1_connect}', visible_only=False)

    s_o_d = app2.window(process=f'{tab1_connect}')

raise ProcessNotFoundError('Process with PID={} not found!'.format(self.process))

pywinauto.application.ProcessNotFoundError: Process with PID=16508 not found!

Vasily Ryabov
@vasily-v-ryabov
process param is an integer PID (process id). Why using f-string? :) Also it’s possible that you face the launcher process that spawns a child one. Use connect by title with optional timeout to connect to proper process. We have feature request to implement auto detection of child processes, but it’s not expected soon.
Mohamed Hamdy
@draconlord
hello all can anyone advice the best setup approach for the pywinauto over win10 64 bit ?
tried python 3.8.1, 3.6 and no luck i always get AttributeError: module 'pywinauto' has no attribute 'application'
using pycharm and the python console works ok when i state from pywinauto import Application
Vasily Ryabov
@vasily-v-ryabov
Hi @draconlord do you mean Python 3.7.6? Both these Python versions have wrong fix for “passing union by value”. The wrong fix is already reverted in Python. Wait for Python 3.8.2 or use 3.8.0 or 3.7.5.
Mohamed Hamdy
@draconlord
@vasily-v-ryabov thank buddy i got it working now
i have a question the app im trying to automate uses check box list not detected by any GUI inspection tool, i know this is app related but i thought you guys could help its a C++ app and i even cant get this dialog using resource hacker either its identified as "pane" class = GLISTCLASS
Vasily Ryabov
@vasily-v-ryabov
@draconlord is it GTK+ app? Everything is bad with GTK on Windows. Really the worst case.
Linux is much much better working with GTK from accessibility point of view.
Vasily Ryabov
@vasily-v-ryabov
@aswathy53408765_twitter let's continue in this room in English.
Mohamed Hamdy
@draconlord
@vasily-v-ryabov it's windows based and all I can get from sniffers scans that it's a VC++ mfc app and not readable by any automation app i.e: ranorex just an element and a scroll bar
Vasily Ryabov
@vasily-v-ryabov
@draconlord I’m in doubt if this is really MFC app. All MFC apps are perfect for automation. Maybe only top level window is an MFC container that contains GTK+ components as children. Can you provide a few screenshots from Inspect.exe in UI Automation mode? For the list and for the main window?
I’ve googled what is GLISTCLASS and it’s GTK. Maybe main window is an MFC container that owns child GTK controls. A few screenshots from Inspect.exe would be helpful.
Mohamed Hamdy
@draconlord
@vasily-v-ryabov here's what inspect shows:
How found: Mouse move (1033,446)
hwnd=0x000709D6 32bit class="GLISTCLASS" style=0x50A00000 ex=0x200
RuntimeId: "[42.461270]"
BoundingRectangle: {l:866 t:369 r:1130 b:549}
ProcessId: 13220
ControlType: UIA_PaneControlTypeId (0xC371)
LocalizedControlType: "pane"
Name: ""
AccessKey: ""
HasKeyboardFocus: false
IsKeyboardFocusable: true
IsEnabled: true
AutomationId: "1"
ClassName: "GLISTCLASS"
HelpText: ""
IsPassword: false
NativeWindowHandle: 0x709D6
IsOffscreen: false
FrameworkId: "Win32"
ProviderDescription: "[pid:7084,providerId:0x709D6 Main:Nested [pid:13220,providerId:0x709D6 Annotation(parent link):Microsoft: Annotation Proxy (unmanaged:uiautomationcore.dll); Main:Microsoft: MSAA Proxy (unmanaged:uiautomationcore.dll)]; Nonclient:Microsoft: Non-Client Proxy (unmanaged:uiautomationcore.dll); Hwnd(parent link):Microsoft: HWND Proxy (unmanaged:uiautomationcore.dll)]"
Scroll.HorizontalScrollPercent: 0.000000
Scroll.HorizontalViewSize: 100.000000
Scroll.VerticalScrollPercent: 0.000000
Scroll.VerticalViewSize: 1.898734
Scroll.HorizontallyScrollable: false
Scroll.VerticallyScrollable: true
IsDockPatternAvailable: false
IsExpandCollapsePatternAvailable: false
IsGridItemPatternAvailable: false
IsGridPatternAvailable: false
IsInvokePatternAvailable: false
IsMultipleViewPatternAvailable: false
IsRangeValuePatternAvailable: false
IsScrollPatternAvailable: true
IsScrollItemPatternAvailable: false
IsSelectionItemPatternAvailable: false
IsSelectionPatternAvailable: false
IsTablePatternAvailable: false
IsTableItemPatternAvailable: false
IsTextPatternAvailable: false
IsTogglePatternAvailable: false
IsTransformPatternAvailable: false
IsValuePatternAvailable: false
IsWindowPatternAvailable: false
IsItemContainerPatternAvailable: false
IsVirtualizedItemPatternAvailable: false
FirstChild: "Vertical" scroll bar
LastChild: "Vertical" scroll bar
Next: (null) title bar
Previous: "" dialogue
Other Props: Object has no additional properties
Children: "Vertical" scroll bar
Ancestors: "Derivatives" window
"View Selection for [Desktop\test.lay]" dialogue
"LayMan - [Desktop\test.lay] " window
"Desktop 1" pane
[ No Parent ]
Vasily Ryabov
@vasily-v-ryabov
@draconlord looks like you're out of luck. Sorry.
LexiconCode
@LexiconCode
Is it possible to obtain a control from cursor?
Vasily Ryabov
@vasily-v-ryabov
@LexiconCode from pywinauto import Desktop; Desktop(backend="uia").from_point(x, y)
LexiconCode
@LexiconCode
That was very helpful thank you!
LexiconCode
@LexiconCode

A couple questions regarding the following code.

from pywinauto import Application
app = Application(backend="uia").connect(process=15900) # Notepad
dlg = app['Untitled - Notepad']
# Timed start
text = app['dlg']['Edit'].get_value() #  329ms to grab the text control
# Timed stop
print(text)
  1. Is there a faster way to retrieve "get_value" before caching?
  2. Reviewing the documentation for https://pywinauto.readthedocs.io/en/latest/code/pywinauto.controls.uia_controls.html#pywinauto.controls.uia_controls.EditWrapper I am a bit confused. I would like to retrieve additional information such as get_value's line_count(). I think I'm confusing the difference between the edit control and its element?

In general my end goal is to be able to:

- Grab Edit/document controls text body
- caret index from beginning of document to current caret position 
- anchor index beginning line index
- anchor position
- grab line index anchor position from the line index. caret indexed at the beginning of the line
- setting the caret/anchor position 

However it seems that caret/anchor is not implemented in pywinauto