Reputation: 51
When i use below pywinauto code, i am getting error saying
from pywinauto.controls.win32_controls import ButtonWrapper
checkbox = ButtonWrapper(app.Dialog.child_window(title='Has Balance',auto_id='HasBalanceCheckEdit',control_type='CheckBox').TCheckBox.WrapperObject())
print(checkbox.GetCheckState())
Error:
raise MatchError(items = name_control_map.keys(), tofind = search_text)
pywinauto.findbestmatch.MatchError: Could not find 'TCheckBox' in 'dict_keys(['Has Balance', 'Has BalanceStatic', 'Static'])'
Upvotes: 0
Views: 3114
Reputation: 51
used import pywinauto.controls.uia_controls
to resolve the above code.
Upvotes: 1
Reputation: 9991
Based on the output you provided, next level spec TCheckBox
is not needed. Just use this code:
checkbox = app.Dialog.child_window(title='Has Balance', auto_id='HasBalanceCheckEdit', control_type='CheckBox').wrapper_object()
Explicit ButtonWrapper
instantiation is also not necessary because the control type is already auto detected by .wrapper_object()
. That's why control_type='CheckBox'
in your child_window
can find the control.
Upvotes: 1