0

This code gets the first window from InstallShield.

from pywinauto import application
from pywinauto import findwindows

app = application.Application()

app.start("MyInstallShieldApp.exe")

time.sleep(15)

hwnd = findwindows.find_windows(title=u"InstallShield Wizard", class_name="MsiDialogCloseClass")
print ("|", str(hwnd), "|")
dlg = app.Window_(handle=hwnd).Wait("enabled", timeout=25, retry_interval=0.5)

Now I want to click the Next button. Swapy says that the Next button has the text '&Next >' and the Button number is 1. But none of these click statements have any effect.

dlg.Click("Next")

dlg.Click(coords=(977, 711))

dlg.Click(button="left")
Vasily Ryabov
  • 9,386
  • 6
  • 25
  • 78
  • Maybe this thread would be useful as an example: http://stackoverflow.com/questions/32846550/python-control-window-with-pywinauto-while-the-window-is-minimized-or-hidden – Vasily Ryabov Mar 17 '16 at 08:40
  • Have you tried to generate `Click()` code using SWAPY? It can be done by popup menu at the button element in the tree. – Vasily Ryabov Mar 17 '16 at 08:46
  • One more useful thread about attribute access: https://github.com/pywinauto/pywinauto/issues/120 – Vasily Ryabov Mar 17 '16 at 09:02

1 Answers1

1

You misapply Click method. It has the next signatire - Click(button=u'left', pressed=u'', coords=(0, 0), double=False, absolute=False)

To click a button, click should be performed on the button object. So you shoud navigate to the button at first.

In your case the code may look something like: dlg['&Next >'].Click()

Again, please do not guess, read the docs and see the examples

SWAPYAutomation
  • 693
  • 4
  • 11