gpt4 book ai didi

protractor - 如何验证 Protractor 中是否存在图像?

转载 作者:行者123 更新时间:2023-12-03 01:17:32 24 4
gpt4 key购买 nike

这是 HTML 代码:

<img ng-src="/static/images/Shine_small.jpg" width="32px" height="32px" src="/static/images/Shine_small.jpg">

这是我的代码:

expect(element(by.binding('/static/images/Shine_small.jpg')).getAttribute('src'))
.toMatch(/static/images/Shine_small.jpg);

最佳答案

您可以使用 HTMLImageElement 只读属性 complete ( w3c spec )

只需注意测试 src 是否为空,因为它也会解析为 complete 为 true。您可以使用 browser.wait 等待一段允许的时间来完成

关于protractor - 如何验证 Protractor 中是否存在图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37201659/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com