# 导包 from selenium import webdriver from selenium.webdriver.common.by import By from time import sleep from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC # 浏览器驱动 driver=webdriver.Chrome() driver.get(r"D:\XXX\myself\1.html") sleep(3) # 寻找元素 点击 # 等找到元素再执行 element=WebDriverWait(driver,10)
.until(EC.visibility_of_element_located((By.CSS_SELECTOR,"#ls_username"))) element.send_keys("fqs") # driver.find_element(By.NAME,"username").send_keys("fqs") # 退出 sleep(2) driver.quit()
解释
html
标签:webdriver,driver,selenium,SELECTOR,import,element,CSS From: https://www.cnblogs.com/haha1988/p/17732425.html