`` 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 # 设置浏览器 driver = webdriver.Chrome() # 访问网站 driver.get("
http://www.baidu.com") # 等待元素 search_box = driver.find_element_by(
By.ID, "ws_gs_search_input") search_box.send_keys("Python") # 提交搜索 search_box.submit() # 等待页面加载完成 WebDriverWait(driver, 10).until(EC.presence_of_element_located((
By.ID, "result_list"))) # 退�出浏览器 driver.quit() ``