为 Selenium 测试构造定位器时属性 xpath="1" 的意义是什么
What is the significance of the attribute xpath="1" while constructing locators for Selenium tests
最近我在基于 angular 的应用程序中偶然发现了一个具有属性 xpath="1"
的元素。
HTML:
我无法找到有关此属性的任何详细信息,以及它可能在 xpath/cssSelector 中对基于 Selenium 的测试的影响和用法。
谁能帮我指点迷津?
该属性 (xpath="1") 由名为 CHROPATH 的浏览器扩展程序放置在那里。它由他们称为 动态属性支持 .
的功能提供
向下滚动第一页会找到有关如何使用该工具的文字说明。
滚动到页面底部的注释:或在页面文本中搜索“注释:”。请特别注意注释#2。整个注释如下:
Note:
- For one selector only, change the dropdown value from selectors to rel XPath/abs Xpath/CSS sel in header.
- Tool will add xpath/css attribute to all the matching node(s) as per their sequential occurrence. For example, a matching node
appearing second in the list will have xpath=2. And if verifying CSS
then it will add css=2.
- Supports only those iframe which are from the same src.
XPath="#"表示匹配节点在网页中出现。它是在您验证自己的 xpath 时由插件添加的。它为检查的元素添加 XPath = '1'。我相信 chropath 现在已被弃用并且没有可用的支持。
最近我在基于 angular 的应用程序中偶然发现了一个具有属性 xpath="1"
的元素。
HTML:
我无法找到有关此属性的任何详细信息,以及它可能在 xpath/cssSelector 中对基于 Selenium 的测试的影响和用法。
谁能帮我指点迷津?
该属性 (xpath="1") 由名为 CHROPATH 的浏览器扩展程序放置在那里。它由他们称为 动态属性支持 .
的功能提供向下滚动第一页会找到有关如何使用该工具的文字说明。
滚动到页面底部的注释:或在页面文本中搜索“注释:”。请特别注意注释#2。整个注释如下:
Note:
- For one selector only, change the dropdown value from selectors to rel XPath/abs Xpath/CSS sel in header.
- Tool will add xpath/css attribute to all the matching node(s) as per their sequential occurrence. For example, a matching node appearing second in the list will have xpath=2. And if verifying CSS then it will add css=2.
- Supports only those iframe which are from the same src.
XPath="#"表示匹配节点在网页中出现。它是在您验证自己的 xpath 时由插件添加的。它为检查的元素添加 XPath = '1'。我相信 chropath 现在已被弃用并且没有可用的支持。