[英]What does contains(., 'some text') refers to within xpath used in Selenium
我是硒编码的新手,我看到几个 xpath 包含 (.,'followed by something') ., 指的是什么?
The .
.
character within the xpath is the short form of text()
xpath中的字符是
text()
的缩写形式
As an example if an WebElement is represented within the DOM Tree as:例如,如果 WebElement 在DOM 树中表示为:
<span>Use this payment method</span>
Effective Locator Strategies will be:有效的定位策略将是:
xpath 1 :路径 1 :
//span[text()='Use this payment method']
xpath 2 :路径 2 :
//span[contains(., 'Use this payment method')]
You can find a couple of relevant discussions in:您可以在以下位置找到一些相关讨论:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.