使用CasperJS验证是否已生成图像

时间:2016-03-21 09:18:20

标签: javascript jquery casperjs

我无法验证执行代码后生成的图像。 以下是HTML代码:

    <div class="live-plot-container">
    <div class="live-plot">
        <div class="live-plot-scroller">
            <div class="ui-resizable ui-resizable-autohide" style="width: 510px; height: 510px;">
                <img id="wk21uyp50py5v3z5dl890x0ue-1"
                     src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAf4AAAH+CAYAAAB9b2wlAAAgAElEQVR4nOzdd3gU1foH8O/MbM1m00N6IQmBUBNCaKFJCUWKoGJBERUriBX9XRXkig0vV8EKqAjY8YpKk94EpBNKCIGEllBCCQnpu9k9vz82u0lI22x2d7K77+d5eHRnzsx5Z3az786Zc85wjDEGQgghhLgEXuwACCGEEGI/lPgJIYQQF0KJnxBCCHEhlPgJIYQQF0KJnxBCCHEhlPgJIYQQF0KJnzSK4zhwHGfXOuxRpz3raa7ii39hTPc2UMokULh7ih2OKMT6jBDibCjxuxjjl6XxnyBTwi8wAn2H3Y1/f/4rblToxQ6R1GHJyEewcn8mnl1zEsV5l8zaRleajW/eewmDe3SEn4cbJIIUHj7B6D5wHN5fvAFakWbwMH72Bi45VW+Zi5vvp8ROiI1Q4ndRjDEwxlBRfBPHd/2JJwaG45uXH0Rk1ECsv...DrgHnn5HvozPE7wzHqt3jh5noMH3INVr6zA2W1bggho6bsKDa/8SymXZqOARPvDPX/QZwJS97cjcZAEJ7aE9i8Zjmu/UkxhkcbsLWi/Sc0p8x67nasuW4OPjhQCG/Aj+MHt2LudS/jlmfndGcIiKi3nNv3ChL1jrZTN9BYINJtmeKYN3DGfm3v03Z73+tLxbhhacKk04ooW5K4fOrPxNbj3542V7l3jZg8epCwGLRCZ7SJ4VfdKj444e50jR3p6Phd2d/Hf/s/ccOVo4QjNlpoNDoRk5gmxl97q/jzup2i5XkJVftfEVePyBRGnVaYYpLFVT9+QOyraxJfLBkndKbY047btobtzywQF2c4hF5rEIlZI8WDz+5o1d5ezXzYIVIWl/qJiIhUhEv9REREKsLgJyIiUhEGPxERkYow+ImIiFSEwU9ERKQiDH4iIiIVYfATERGpCIOfiIhIRRj8REREKsLgJyIiUpH/Ai6X+v11dxqqAAAAAElFTkSuQmCC"
                     style="width: 100%; height: 100%;">
                <div class="ui-resizable-handle ui-resizable-e" style="z-index: 90; display: none;"></div>
                <div class="ui-resizable-handle ui-resizable-s" style="z-index: 90; display: none;"></div>
                <div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se"
                     style="z-index: 90; display: none;"></div>
            </div>
            <br>
        </div>
<span class="live-plot-commands" style="display: none;">
    </div>
</div>

以下是CasperJs代码

casper.then(function (){
    var temp = this.getElementInfo('#wk21uyp50py5v3z5dl890x0ue-1');
    this.echo(temp);
    this.test.assertExists("#wk21uyp50py5v3z5dl890x0ue-1");
})

我正在尝试检查使用唯一选择器生成的图像,当我运行脚本时,错误显示在命令行/终端

  

失败无法从#wk21uyp50py5v3z5dl890x0ue-1获取信息:找不到元素。   类型:uncaughtError

     

file:VerifyImage.js

     

失败无法从#wk21uyp50py5v3z5dl890x0ue-1获取信息:找不到元素。

     

堆叠:未提供

     

FAIL 9测试在88.737s中执行,8次传递,1次失败,0次可疑,0次跳过。

0 个答案:

没有答案