asweigart / pyautogui

A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
BSD 3-Clause "New" or "Revised" License
10.5k stars 1.27k forks source link

linux VM doesn't accept password entered by pyautogui #839

Open phirestalker opened 9 months ago

phirestalker commented 9 months ago

OK, this is a weird one. I have no idea what to search for, as I have tried multiple terms. I even tried ai.

I have an app called UTM on macOS. This is a wrapper for QEMU. One of the virtual machines I run requires a password. I like to keep all of my passwords inside a password manager. I used to use KeepassXC (which can successfully type the password by the way). I have switched to Vaultwarden, so I am forced to write my own autotype utility. I started with pynput and now I am using pyautogui. I really prefer pyautogui, so I would like to keep using it.

When I type passwords into native macOS applications it works great, no complaints. When I try to type a password into a VM running in UTM, it will say invalid password. I have set the field to show and had pyautogui type the password. It looks perfect visually. I would say it typed it perfectly, but the Linux guest does not accept the password.

macOS version: 14.3.1 Python version: 3.11.7 Guest OS: Whonix 17 (haven't tested any other VMs though)

I am using write like so pyautogui.write(entry['login']['password'], KEYPRESS_DELAY) and KEYPRESS_DELAY has been 50/1000 and 100/1000. I do not know how to troubleshoot this further. I guess there could be invisible characters being typed into the password field, but I don't know how to find out.

Has anyone else had this problem? What can I do to troubleshoot further?

Thanks all.

darkb0ts commented 8 months ago

encoding of the password being typed by pyautogui matches the expected encoding within the VM