在windows上提交表单后,phantomJS崩溃了

时间:2015-04-09 08:46:25

标签: testing phantomjs automated-tests casperjs acceptance-testing

我在Windows机器上运行casperjs测试。一切正常,直到我在填写表单后单击提交按钮,phantomjs崩溃并且在提交代码后没有执行测试。

 casperjs --version
2.0.0

表单HTML是:

<form id="assessment20config" action="/facilities/105/assessments/" method="post">
    <table style="margin-left:5px;" class="row">
        <tbody>
            <tr class="small-headers">          <!-- All Headers -->
                <td class="col-xs-6">
                    <span>Select Assessment:</span>
                </td>
                <td class="col-xs-1">
                    <span style="margin-left:-15px;">Frequency:</span>
                </td>
                <td class="col-xs-2">
                    <span>Assessment Name:</span>
                </td>
            </tr>

            <tr>
                <td>
                    <select id="azzezzmentz-list" class="pull-left" style="padding:1px;" name="azzezzmentSelected">
                        <option value="1" >Lamplight Ft. Wayne Assessment  
                        </option>
                        <option value="2" >Lamplight Baltimore Assessment  
                        </option>

                    </select>
                </td>
                <td>
                    <input id="frequency-textbox" type="number" name="frequency" required="required" min="0" style="width: 60px;">
                </td>
                <td>
                    <input type="text" name="alternateName" required="required" style="width: 150px;">
                </td>
            </tr>
        </tbody>
    </table>
    <br>
    <input id="schedule-azzezzment-for-facility" class="btn btn-primary" type="submit" value="Schedule">
</form>

测试代码是:

var that = this;

this.fillAssessment2ScheduleForm = function(selectAssessment, frequency, assessmentName) {
    that.obj["select[name='azzezzmentSelected']"] = selectAssessment;
    that.obj["input[name='frequency']"] = frequency;
    that.obj["input[name='alternateName']"] = assessmentName;   

    casper.fillSelectors("form[action*='/assessments/']", that.obj, true);
}

此消息显示

PhantomJS has crashed. Please read the crash reporting guide at
 and file a bug report at
.
Please attach the crash dump file:
  C:\Users\***\AppData\Local\Temp\59fc7a7e-27e9-4116-8aed-d14d7ddae6a7.dmp"

在dmp文件中有一系列Ascii代码,如:

4d44 4d50 93a7 8063 0900 0000 2000 0000
0000 0000 a734 2655 0000 0000 0000 0000
0300 0000 c403 0000 ac04 0000 0400 0000
b014 0000 7c08 0000 0500 0000 9401 0000
d76b 0000 0600 0000 a800 0000 0404 0000
0700 0000 3800 0000 8c00 0000 0f00 0000
4003 0000 c400 0000 0100 6747 0c00 0000
cb6b 0000 0000 0000 0000 0000 0000 0000
....

1 个答案:

答案 0 :(得分:0)

解决了我自己。 幻像崩溃的原因可能是: - 给出错误的选择器。 - 在casper.fillSelectors之后使用true作为最后一个参数回显一些字符串。