from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
def ready(browser:webdriver) -> bool:
readyState = browser.execute_script('return document.readyState')
if readyState == 'complete':
return True
return False
browser = webdriver.Firefox()
browser.get('http://xxx.xxx.xxx')
WebDriverWait(browser, 60).until(ready)
WebDriverWait(browser, 60).until(lambda browser: browser.execute_script('return document.readyState')=='complete')
留言
張貼留言