id定位:find_element_by_id(self, id_)
定位id为lUsername
driver.find_element_by_id('lUsername')
name定位:find_element_by_name(self, name)
class定位:find_element_by_class_name(self, name)
tag定位:find_element_by_tag_name(self, name)
link定位:find_element_by_link_text(self, link_text)
说明:link_text专门用来定位超链接
link_text定位实现步骤与id定位实现步骤相似
link_text定位 案例代码:(点击‘聚划算’,实现跳转)
driver.find_element_by_link_text('形式与政策')
partial_link定位find_element_by_partial_link_text(self, link_text)
说明:partial_link_text定位是对link_text定位的补充,partial_like_text为模糊匹配;link_text 全部匹配
driver.find_element_by_partial_link_text('形式')
xpath定位:find_element_by_xpath(self, xpath)
css定位:find_element_by_css_selector(self, css_selector)