Search code examples
automationpyautogui

Pyautogui automation - Identify waiting time issue


I am trying to automate a task with pyautogui. After a click program starts loading for few second and this time varies every time. Th script has to wait for that time to perform next operation/click. I was thinking to take the screenshot but in screenshot mouse cursor is not showing and loading is shown on the cursor itself. what could be the best possible way to identify this loading time and stop the script for that seconds before performing next instructions.


Solution

  • You provided vague details, but I'll try to provide a way given what I understood.

    So basically when you click, a program starts loading, and you want to find out when the program finished loading so you can execute the next part of the script?

    If the program was gui based, I'm pretty sure, there are pixel changes before loading and after loading, you could for example use pyautogui.pixelMatchesColor(x, y, (R, G, B)) on a loop, to check whether a pixel in the program has changed, this could mean that the program finished loading.