【问题标题】:Codeception: how to test if an image is loaded?Codeception:如何测试图像是否已加载?
【发布时间】:2017-11-06 09:35:39
【问题描述】:

我正在尝试这样做

$I->seeElement('DIV#security IMG.verisign'); 

检查带有威瑞信标志的图片是否已加载,但即使图片未加载,测试通过(如果来源错误)。

检查图片加载的正确方法是什么?

【问题讨论】:

    标签: selenium codeception facebook-php-webdriver


    【解决方案1】:

    您可以检查naturalHeight 以验证图像是否正确加载:

    $this->assertGreaterThan($element->getAttribute('naturalHeight'), 1);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-02
      • 1970-01-01
      • 2014-02-01
      • 2014-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-04
      相关资源
      最近更新 更多