I am using pywinauto to automate a windows GUI. app.machine.Reset.click() returns the following error
File "C:\PythonCAT\x64\2.6\lib\site-packages\pywinauto\application.py", line 236, in __getattr__
return getattr(ctrls[-1], attr)
AttributeError: 'ButtonWrapper' object has no attribute 'click'
I have tried using click_input()
& click()
. I get the same error message AttributeError: 'ButtonWrapper' object has no attribute 'click'
.
I read documentation related to pywinauto as well
The solution in the post below did not work for me. I am using python 2.6.6 and pywinauto version 0.5.0
Not able to automate button click on "Oracle VM virtual box" using pywinauto in python
from pywinauto.application import Application
def test():
try:
os.startfile(r'''machine.exe''')
app= Application().connect(path=r'''machine.exe''')
app.machine.DrawOutline()
app.machine.PrintControlIdentifiers()
#app.machine.menu_select("File->Exit")
app.machine.Reset.click()
#app.machine.Reset.click_input()
finally:
print(" done")
test()
app.machine.Reset.click()
returns the following error:
File "C:\PythonCAT\x64\2.6\lib\site-packages\pywinauto\application.py", line 236, in __getattr__
return getattr(ctrls[-1], attr)
AttributeError: 'ButtonWrapper' object has no attribute 'click'
Any help is appreciated. All the posts I have read recommend using click() or invoke() or click_input(). I have tried using each of them and I got the same error message for each. I am trying to click on the button Reset in the GUI.
app.machine.Button9.Click() worked for me.
app.machine.PrintControlIdentifiers() gave me the list of identifiers for the controls present on the GUI. One of them is Button9.So instead of using the name of the button called Reset using Button9 worked fine.