from selenium.webdriver.common.by import By
# id属性定位
find_element(By.ID,"id")
# name属性定位
find_element(By.NAME,"name")
# classname属性定位
find_element(By.CLASS_NAME,"claname")
# a标签文本属性定位
find_element(By.LINK_TEXT,"text")
# a标签部分文本属性定位
find_element(By.PARTIAL_LINK_TEXT,"partailtext")
# 标签名定位
·find_elemnt(By.TAG_NAME,"input")
# xpath路径定位
find_element(By.XPATH,"//div[@name='name']")
# css选择器定位
find_element(By.CSS_SELECTOR,"#id")
网友评论