TypeError:null不是一个对象(评估' this.casper.evaluate(function _evaluate()

时间:2016-09-11 15:28:32

标签: javascript casperjs

我正在写一个简单的测试。基本上,我需要能够转到2个网址并声明存在特定文本。

我有以下示例代码。当我执行代码时,我收到一个错误" FAIL TypeError:null不是一个对象(评估' this.casper.evaluate(function _evaluate()"。第四个断言 - test.assertTextExists是失败的。有人可以帮我调查这个问题......

CasperJs版本:casperjs-1.1.3 PhantomJs版本:phantomjs-2.1.1-windows

var baseurl = "http://www.t-mobile.com";

casper.test.begin('T-Mobile page contains Unlimited Talk & Text - 2', 2, function suite(test) {
    casper.start(baseurl + "/businessoffer/unlimited-data-story.html", function() {
        test.assertTitle("Unlimited Data For Business | Data Rollover and Free Streaming");
        test.assertTextExists('It’s YOUR data, use it however YOU want.');
    });

    casper.run(function() {
        test.done();
    });
});

casper.test.begin('T-Mobile page contains Unlimited Talk & Text', 2, function suite(test) {
    casper.start(baseurl + "/businessoffer/wifi-calling-wifi-extenders.html", function() {
        test.assertTitle("Wifi Calling & Wifi Extenders for Better Service at Home | T-Mobile");
        test.assertTextExists('Unlimited talk & text');
    });

    casper.run(function() {
        test.done();
    });
});

0 个答案:

没有答案
相关问题