Skip to content

Instantly share code, notes, and snippets.

@RemcoTukker
RemcoTukker / pywinauto_firstchild.py
Created June 18, 2017 19:36
Monkey patch for pywinauto that adds a first_only parameter to the window function for the UIA backend, in order to work around slow FindAll calls (win10 bug?)
# Monkey patch for pywinauto that adds a first_only parameter to the window function
# for the UIA backend, in order to work around slow FindAll calls (win10 bug?)
# First copy paste this code on your REPL, then do:
# d1 = pywinauto.Desktop("uia")
# d1.window(first_only=True, title="Calculator").window_text()
# Currently only title is supported, but its easy to implement all the others as well,
# most importantly title_re
def first_child(self):
print("Getting first child")