标签:lin _id 2-2 路径 blank tor color family har
find_elements_by_id() #通过id定位
find_elements_by_name() #通过name
find_elements_by_class_name() #class name
find_elements_by_tag_name() #通过tag定位
find_elements_by_link_text()
find_elements_by_partial_link_text()
find_elements_by_xpath()
find_elements_by_css_selector()
通过xpath定位相对路径
dr.find_element_by_xpath("//*[@id=‘kw‘]")
dr.find_element_by_xpath("//*[@name=‘wd‘]")
dr.find_element_by_xpath("//input[@class=‘s_ipt‘]")
dr.find_element_by_xpath("/html/body/form/span/input")
dr.find_element_by_xpath("//span[@class=‘soutu-btn‘]/input")
dr.find_element_by_xpath("//form[@id=‘form‘]/span/input")
dr.find_element_by_xpath("//input[@id=‘kw‘ and @name=‘wd‘]")
通过css定位,css定位很多简单讲解
dr.find_element_by_css_selector("#kw")
dr.find_element_by_css_selector("[name=wd]")
dr.find_element_by_css_selector(".s_ipt")
dr.find_element_by_css_selector("html > body > form > span > input")
dr.find_element_by_css_selector("span.soutu-btn> input#kw")
dr.find_element_by_css_selector("form#form > span > input")
跳转至selenium快捷键操作https://www.cnblogs.com/cheng10/p/10271018.html
标签:lin _id 2-2 路径 blank tor color family har
原文地址:https://www.cnblogs.com/cheng10/p/10283403.html