Skip to content Skip to sidebar Skip to footer

How To Wait For The Page To Fully Load Using Webbrowser Method?

import webbrowser, sys, time import pyautogui print('Googling...') googleSearch = '+'.join(sys.argv[1:]) if len(sys.argv) > 1: webbrowser.open_new_tab('https://google.com/

Solution 1:

You could use the google search endpoint, so you don't need to click enter in the search box on the main page of google

safe_search = urllib.parse.quote_plus(search_term)
webbrowser.open_new_tab("https://google.com/search?q={}".format(safe_search)

Solution 2:

Maybe this help.

I use the logo to detect if the website is already loaded. But could be anything, a button, etc.

url = 'https://site'

webbrowser.open(url)

whileTrue:
    logo = pyautogui.locateOnScreen('logo.png')
    if logo isnotNone:
        breakprint logo

Post a Comment for "How To Wait For The Page To Fully Load Using Webbrowser Method?"