【Python网络编程】selenium之等待页面异步加载完成

时间:2024-04-16 10:26:33
# 需要导入的库
import
os import time from selenium import webdriver from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By import base64 import gevent import datetime from gevent import monkey monkey.patch_all()

...

   # 1.先声明browser

  browser = webdriver.PhantomJS(\'phantomjs路径,系统环境变量有,参数为空即可\')
  browser.get(\'浏览器地址\')
  locator = (By.CSS_SELECTOR, \'#sorting_1\')
  tables = wait.until(
  EC.presence_of_all_elements_located(locator)
  )