元素是否在DOM中没有内部文本,如何获得该值?
如何获得值99 < /代码>在测试过程中? 我正在使用剧作家,以及
innertext()
或textContent()
根本不起作用的东西。
await expect(page.locator(element)).toHaveText('99') //OR
await expect(page.locator(element).innerText()).toBe('99')
这些方法应该从
This is an example of such element
How is it possible to get the value 99
during testing?
I'm using playwright and anything like innerText()
or textContent()
don't work at all.
await expect(page.locator(element)).toHaveText('99') //OR
await expect(page.locator(element).innerText()).toBe('99')
It's fully logical that these methods should get the value from elements like that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须检查为此的价值的存在。
You have to check the presence of value for this.