Reputation: 31
I am trying to do something (I think) should simple I am trying to select a button named "Start". I have been looking for documentation that describes how-to click a button (with descent example). I have been unable to find any. Anyway here is the error I get:
Traceback (most recent call last):
File "C:\Python Scripts\TestVBApp2.py", line 18, in <module>
vbButton1 = ButtonWrapper(vbapp.Button.WrapperObject("Start")).Click
TypeError: WrapperObject() takes 1 positional argument but 2 were given
Here is the code:
from pywinauto.application import Application
from time import sleep
from pywinauto.controls.win32_controls import ButtonWrapper
import pyautogui
pyautogui.FAILSAFE = True
app = Application().Start(cmd_line=u'"C:\\VBPrograms\\SimpleWPFApp.exe"')
app.MainWindow.Wait('ready')
vbapp = app.window_(title_re="MainWindow")
vbButton1 = ButtonWrapper(vbapp.Button.WrapperObject("Start")).Click
Attached is a screenshot of the app with the "Start" button.
Upvotes: 3
Views: 11682