我是硒编码的新手,我看到几个 xpath 包含 (.,'followed by something') ., 指的是什么?
The .
character within the xpath is the short form of text()
As an example if an WebElement is represented within the DOM Tree as:
<span>Use this payment method</span>
Effective Locator Strategies will be:
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:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.