selenium笔记

1.关于定位元素的方法:

find_element("id","")
find_element("xpath","")
find_element("link text","")
find_element("partial link text","")
find_element("name","")
find_element("tag name","")
find_element("class name","")
find_element("css selector","")

2.使用简化方法例子

a.find_element("xpath","//*[@id=\"app\"]/section/main/section/main/div/div/footer/div/div[5]/div[2]/button").click()

3.使用复数定位举例

 

 如图当前研讨列表class相同但位置不同,则可使用复数定位的方法如:

a.find_elements_by_class_name('vue-recycle-scroller__item-view')[0].click()
a.find_elements_by_class_name('vue-recycle-scroller__item-view')[1].click()
a.find_elements_by_class_name('vue-recycle-scroller__item-view')[2].click()

  

posted @ 2020-10-12 16:16  剑器近丶  阅读(112)  评论(0编辑  收藏  举报