标签:rom argument find less 界面 uri locate expect ref
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
chrome_options = Options()
chrome_options.add_argument(‘--headless‘)
chrome_options.add_argument(‘--disable-gpu‘)
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.implicitly_wait(10)
wait = WebDriverWait(driver, 10, 0.5)
driver.get("https://www.baidu.com")
driver.find_element_by_id("kw").send_keys("Na_years")
driver.find_element_by_id("su").click()
wait.until(EC.presence_of_element_located((By.LINK_TEXT, ‘Na_years - 博客园‘))).click()
time.sleep(3)
driver.quit()
标签:rom argument find less 界面 uri locate expect ref
原文地址:https://www.cnblogs.com/Nayears/p/12177671.html