包含(.,'某些文本')在Selenium中使用的xpath中指的是什么 [英] What does contains(., 'some text') refers to within xpath used in Selenium
本文介绍了包含(.,'某些文本')在Selenium中使用的xpath中指的是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是硒编码的新手,我看到几个xpath包含(.,其后是某物").指的是什么?
I am new to selenium coding, and I am seeing several xpaths that contain (.,'followed by something') what does the ., refer to?
推荐答案
.
字符title =显示标记为'xpath'的问题"" rel ="tag"> xpath 是text()
例如,如果WebElement在 DOM树中表示为:
As an example if an WebElement is represented within the DOM Tree as:
<span>Use this payment method</span>
有效的定位器策略为:
-
xpath 1 :
//span[text()='Use this payment method']
xpath 2 :
//span[contains(., 'Use this payment method')]
您可以在以下位置找到一些相关的讨论:
You can find a couple of relevant discussions in:
- How to locate the button element using Selenium through Python
- While fetching all links,Ignore logout link from the loop and continue navigation in selenium java
- How does dot(.) in xpath to take multiple form in identifying an element and matching a text
这篇关于包含(.,'某些文本')在Selenium中使用的xpath中指的是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文