我正在尝试编写一个Selenium测试来验证“在Y秒内找到X结果”形式的一些文本,其中Y会发生变化。我知道Selenium不支持通配符,但支持XPath表达式。但是我的测试总是失败。
元素:
<div class="row">
<div class="col col-12 apex-col-auto" >
<div id="R97298480703869613" class="">
Found 0 results in 0.138 seconds.
</div>
</div>
</div>值:
xpath=(//div[contains(text(), "Found")])测试:

但我只能得到这样的结果:
Failed: Actual value "Found 0 results in 0.007 seconds."
did not match "xpath=(//div[contains(text(), "Found")])"我尝试过text()、./text()和.,我只是不正确地编写了这个XPath表达式吗?
发布于 2021-10-28 16:27:10
store text|[your element]|StoredText
execute script|return ${StoredText}.includes("Found")|x
assert|x|truehttps://stackoverflow.com/questions/69667494
复制相似问题