JS WebDriverio如何检查页面上是否存在标签H1
我尝试这样做:
await browser.url(https://webdriver.io/');
expect(browser).toHaveText('h1')
因此尝试:
await browser.url(https://webdriver.io/');
await browser.findElement('xpath', 'h1')
但是这无济于事
I tried doing like this:
await browser.url(https://webdriver.io/');
expect(browser).toHaveText('h1')
so tried:
await browser.url(https://webdriver.io/');
await browser.findElement('xpath', 'h1')
But it doesn't help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有人可以告诉我如何在循环中检查H1标签的存在吗?测试立即崩溃,没有打印没有H1的页面
Can someone tell me how to check for the presence of the h1 tag in the loop? The test immediately crashes and does not print pages that do not have h1
这就是我解决这个问题的方式:
this is how i solved the issue: