Press key with pywinauto

Just use

# from pywinauto.SendKeysCtypes import SendKeys # old for pywinauto==0.5.x
from pywinauto.keyboard import send_keys

send_keys('some text{ENTER 2}some more textt{BACKSPACE}', with_spaces=True)

Docs: https://pywinauto.readthedocs.io/en/latest/code/pywinauto.keyboard.html

P.S. SendKeysCtypes was renamed to keyboard in pywinauto 0.6.0+.


I had to change the include to get the code working:

from pywinauto.keyboard import send_keys, KeySequenceError

send_keys('some text{ENTER 2}some more textt{BACKSPACE}', with_spaces=True)

Tags:

Pywinauto