I have a pyautogui code that repeats a order to click on a webpage but sometimes that webpage freezes and does not load, how could i detect that.

the webpage in not on selenium and chrome has been opened by pyautogui too

Update 1:
I have just realised that the website will realise that i have been on the website for a long time so it will not load certain elements. This usually happens evry 20 minutes.
I finally solved the problem by simply reloading the page every 20 minutes which solved the problem.
Pyautogui inactivity detection