WebDriver API 4-By positioning element (Mushishi "selenium3 automated testing combat - based on the Python language note 11")

By using the positioning element, you need to import the following statement:

from selenium.webdriver.common.by import By

find_element (By. value type of positioning, positioning)

find_element(By.ID, "kw")
find_element(By.NAME, "wd")
find_element(By.CLASS_NAME, "s_ipt")
find_element(By.TAG_NAME, "input")
find_element(By.LINK_TEXT, "新闻")
find_element(By.PARTIAL_LINK_TEXT, "")
find_element(By.XPATH, "//*[@class= 'bg s_btn']")
find_element(By.CSS_SELECTOR, "span.bg s_btn_wr>input#su")

 

Guess you like

Origin www.cnblogs.com/kite123/p/11464686.html
Recommended