I am following Chapter 18 of Automate the Boring Stuff with Python. I'm on OS X.
I am trying to use pyautogui
to click on a text input or text document and then input text.
I am entering the following into a shell ((370, 80)
are the coordinates of my Chrome address bar):
pyautogui.click(370,80); pyautogui.typewrite('Hello world!')
click()
seems to not be working as expected. It will highlight text in an input when I click on the input, but even when I manually type after the click, the text shows up in the shell. See the below screenshot of the result of running the above line:
Other methods like position
, moveTo
, moveRel
, and dragTo
are working as expected.
If I run time.sleep(5); pyautogui.typewrite('test')
and manually click on the text document or input while the thread is sleeping, the text is inputted as desired.
What might be the problem?