Getting a 'type error-cannot unpack' on every second try

Using pyautogui, creating a simple program to log me into a vpn. First part of the code works fine each time, (double clicking an icon on desktop), the second part, left clicking on the connect button, works every other try. When it doesnt work im getting a type error. 'TypeError: cannot unpack non-iterable NoneType object'. However, this only occurs every second try. Every other try it works just fine. I ran it 50 times, and exactly every other try it works/doesnt work.

source code

🔴 No definitive solution yet