Automate 'enter' key in Python (on Mac)

I am creating test automation for an application. I use a testing tool to do most of the testing, but in order to get to this point, I first need to automate one click on 'enter' in Python. I am using mac, so pywin32 is not available. Any suggestions?

+5
source share
2 answers

Appscript makes this pretty easy:

from appscript import app
app('System Events').keystroke('\r')

This will result in a keystroke depending on which application is in front.

+1
source

, , .

, 'Enter' Ctrl-r, .

, !

0

All Articles