标签:imp 基础 com selenium play col *** rom tps
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.select import Select driver = webdriver.Chrome() driver.get("https://www.***.cn") #获取文本 text = driver.find_element(By.CSS_SELECTOR,"***").text #获取属性值 value = driver.find_element(By.CSS_SELECTOR,"***").get_attribute("value") #是否可见 displayed = driver.find_element(By.CSS_SELECTOR,"***").is_displayed() #是否勾选 selected = driver.find_element(By.CSS_SELECTOR,"***").is_selected() #输入文本 driver.find_element(By.CSS_SELECTOR,"***").send_keys("***") #清除文本 driver.find_element(By.CSS_SELECTOR,"***").clear() #单击元素 driver.find_element(By.CSS_SELECTOR,"***").click() #下拉框选择 ele = driver.find_element(By.CSS_SELECTOR,"***") #根据value选择 Select(ele).select_by_value("value") #根据text选择 Select(ele).select_by_visible_text("text") #根据索引选择0开始 Select(ele).select_by_index(index) driver.quit()
标签:imp 基础 com selenium play col *** rom tps
原文地址:https://www.cnblogs.com/nicole-zhang/p/10383473.html