目录
元素定位
from selenium.webdriver.common.by import By
<input id="kw" name="wd" class="s_ipt" value="" maxlength="255" autocomplete="off">
driver.find_element(By.NAME, "wd").send_keys("selenium")
driver.find_element(By.CLASS_NAME, "s_ipt").clear()
driver.find_element(By.XPATH, "//input[@id = 'kw']").send_keys("webdirver")
driver.find_element(By.ID, "kw").send_keys("webdirver")
<a href="https://www.hao123.com" target="_blank" class="mnav c-font-normal c-color-t">hao123</a>
driver.find_element(By.LINK_TEXT, "hao123").click()
driver.find_element(By.PARTIAL_LINK_TEXT, "hao").click()
By.CSS_SELECTOR
By