selenium+pthon----元素定位参数化
之前有学习过元素定位的8大方法
find_element_by_id
find_element_by_xpath
find_element_by_link_text
find_element_by_partial_text
find_element_by_name
find_element_by_tag_name
find_element_by_class_name
find_element_by_css_selector
在yoyo的博客里看到可以对元素定位进行参数化
by_id= "id"
by_xpath = "xpath"
by_link_text = "link text"
by_partial_text = "partial link text"
by_name = "name"
by_tag_name = "tag name"
by_class_name = "class name"
by_css_selector = "css selector"
用法:
原来普通的写法:find_element_by_id("kw").send_keys("python")
参数化的写法: find_element(“id”,"kw").send_keys("python")
find_element(By.ID,"kw").send_keys("python") ---这种写法要导入By模块
其它方法用法类似