Wednesday, February 5, 2020

launch notepad and open about dialog from menu and type some text


#pip install --upgrade pywinauto

#pip install pypiwin32

from pywinauto import application

app = application.Application()

app.start('notepad.exe')

app.Notepad.MenuSelect('help->aboutnotepad')

app.aboutnotepad.OK.click()

app.notepad.edit.type_keys('Hello')

app.notepad.edit.type_keys('World')
Sample 2
from pywinauto.application import Application
# Run a target application
app = Application().start("notepad.exe")
# Select a menu item
app.UntitledNotepad.menu_select("Help->About Notepad")
# Click on a button
app.AboutNotepad.OK.click()
# Type a text string
app.UntitledNotepad.Edit.type_keys("pywinauto Works!", with_spaces = True)

No comments:

Post a Comment