【发布时间】:2021-09-13 01:04:52
【问题描述】:
我在页面上有一个文本,我必须验证该文本是否存在。元素的 html 是 <p class="subfooter__text" data-v-79ab1348=""> The Tesla is part of the <a href="//www.xyz.com/" target="_blank" rel="noopener nofollow">Automobile</a> publishing family.</p>
需要验证的文字是“特斯拉是汽车出版家族的一部分”。问题是,当断言全文时断言失败,但断言“汽车”或“出版系列”或“汽车出版系列”时它确实通过了。对于 href 标记之前的文本,断言永远不会通过。
这是代码部分browser.assert.containsText('p.subfooter__text', 'The Tesla is part of the Automobile publishing family'); 我确保所有空格都得到了照顾。
非常感谢任何帮助。
【问题讨论】:
标签: javascript selenium nightwatch.js nightwatch