# chromedriver ```python from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC # 配置 chrome_options = Options() chrome_options.add_argument('--no-sandbox')#解决DevToolsActivePort文件不存在的报错 # chrome_options.add_argument('window-size=900x500')#指定浏览器分辨率 chrome_options.add_argument('--disable-gpu')#谷歌文档提到需要加上这个属性来规避bug # chrome_options.add_argument('--hide-scrollbars')#隐藏滚动条, 应对一些特殊页面 # chrome_options.add_argument('blink-settings=imagesEnabled=false')#不加载图片, 提升速度 # chrome_options.add_argument('--headless')#浏览器不提供可视化页面. linux下如果系统不支持可视化不加这条会启动失败 driver = webdriver.Chrome(chrome_options=chrome_options, executable_path="./chromedriver") driver.set_window_size(900, 500) driver.get('你要访问的地址') # 等待页面中出现 id=filter-bar 的元素 try: element = WebDriverWait(driver, 60).until( EC.presence_of_element_located((By.ID,"filter-bar")) ) except: driver.quit() ```