Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是我为 Selenium/PHPUnit 编写的代码:
$this->getXpathCount("//img[contains(@src, 'yes_star')]/../div[contains(text(), '0')]
如何重写此代码以计算不包含文本 0 的元素的 xpath?
使用not()函数,例如:
not()
//img[contains(@src, 'yes_star')]/../div[not(contains(text(), '0'))]