0

This is my code right here in Python and I am using web browser module and pyautogui module.

I wanted a way in which I can check if the webpage is loaded completely so that the required actions do not take place at a blank screen.

import webbrowser
import pyautogui, time

url = 'youtube.com'  # or something else


chrome_path = r"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

webbrowser.register("chrome", None, webbrowser.BackgroundBrowser(chrome_path))

webbrowser.get("chrome").open_new_tab(url)

I want to execute the below code after the page is completely loaded. Currently i am using the time.sleep manual function but it doesn't work pretty well and is inefficient

time.sleep(20)

pyautogui.leftClick(484, 447)
alift
  • 1,855
  • 2
  • 13
  • 28

0 Answers0