1、python3+selenium之常见的页面元素定位方法
一、ID定位
find_elemet_by_id("")
二、name定位
find_element_by_name("")
三、class定位
find_element_by_class_name("")
四、tag定位
find_element_by_tag_name("")
五、link定位
find_element_by_link_text("")
六、partial link定位
find_element_by_partial_link_text("")
对link定位的补充,有些文本链接比较长,这里只需取一部分即可
七、XPath定位
find_element_by_xpath("")
此处可使用绝对路径或相对路径
eg:find_element_by_xpath("//form[@id='form']/span/input[2]")
表示id是'form'的form标签下的span标签下的第2个input标签
八、CSS定位
find_element_by_css_selector(".class")
find_element_by_css_selector("#id")
find_element_by_css_selector("")
九、By定位元素
find_element(By.ID,"")
find_element(By.NAME,"")
find_element(By.CLASS,"")
find_element(By.TAG_NAME,"")
find_element(By.LINK_TEXT,"")
find_element(By.PARTIAL_LINK_TEXT,"")
find_element(By.XPATH,"")
find_element(BY.CSS_SELECTOR,"")
阅读更多
- [python爬虫] Selenium常见元素定位方法和操作的学习介绍
- [python爬虫] Selenium常见元素定位方法和操作的学习介绍
- [python爬虫] Selenium常见元素定位方法和操作的学习介绍
- [python爬虫] Selenium常见元素定位方法和操作的学习介绍
- Selenium常见元素定位方法和操作的学习介绍-python爬虫
- Python+Selenium的元素定位方法(xpath)
- Python+Selenium定位不到元素常见原因及解决办法(报:NoSuchElementException)
- selenium 总结篇,常见方法和页面元素的操作
- selenium总结篇 常见的方法和页面元素的操作
- Selenium with Python 003 - 页面元素定位
- Selenium常见元素定位方法和操作的学习介绍
- 【二】【selenium+python】发现页面元素的方法介绍
- python+selenium之定位web页面元素:输入、点击事件触发
- Selenium示例集锦--常见元素识别方法、下拉框、文本域及富文本框、鼠标操作、一组元素定位、弹窗、多窗口处理、JS、frame、文件上传和下载
- Python使用Selenium测试WebApp在定位元素和使用元素属性报的莫名其妙错误的终极解决方法
- python+selenium之定位web页面元素二:css定位
- selenium python (二) 元素定位方法
- selenium 页面元素的定位方法
- python+selenium几种常见的定位方法(整合)
- 使用selenium+python;在页面A点击一个按钮跳转到页面B,页面A没有关闭,浏览器打开了一个B,切换窗口定位页面B的元素