webdriervAPI basic element positioning

from  selenium  import  webdriver

driver  =  webdriver.Chorme()

driver.get("http://www.baidu.com")

 

"" "Basic targeting method." ""

driver.find_element_by_class_name ( "") method to locate the element by the class attribute

 

dirver.find_element_by_name ( "") for positioning the name attribute

 

driver.find_element_by_id ( "") for positioning the id attribute

 

driver.find_element_like_text ( "News") like designed to locate text link

 

driver.find_element_partial_like_text ( "a longer text link")  

  partial like complements the like, and some text links will be longer, to locate a part of this time we can go text link

 

driver.find_element_tag_name ( "") to locate an element by element name tag, this method is not recommended, to identify an element of probability is very low.

Guess you like

Origin www.cnblogs.com/97xiaolai/p/11706859.html