需要检查文本是否在break(br)标记后可用
HTML代码:
<div class="a-column a-span3">
<a class="footer-link" target="_blank" rel="noopener" href="https://www.community.com/">
<span class="footer"><b>Community</b></span>
<br>
Connect
<br>and fun
</a>
</div>
<div class="a-column a-span3">
<a class="footer-link" target="_blank" rel="noopener" href="https://www.google.com/">
<span class="footer"><b>google</b></span>
<br>
Contact
<br>and get help
</a>
</div>
我尝试过并得到错误是:
1) AssertionError: expected false to be truthy
48 | async checkFooter(footerText){
> 49 | await t.expect((Selector('[id=container]').child('div').nth(14).child('div').nth(5).child('div').child('div').nth(2).child('a').withText(footerText)).exists).ok();
50 | }
普通Xpath://*[@id="container"]/div[14]/div[5]/div/div[2]/a/text()[1]
如何使用text('Contact')为此元素编写xpath并在break语句之后验证其是否可用
XpathSelector的帮助下,我们使用普通的xpath作为我们希望在硒中使用的xpath。