node.js僵尸无头浏览器不加载网址

时间:2015-04-23 22:48:09

标签: node.js zombie.js jasmine-node

工具

  • Linux ubuntuG5 3.13.0-48-powerpc64-smp
  • node.js v0.10.38
  • zombie Version 3.1.0 2015-03-15
  • jasmine-node 1.14.3

sample_zombie_spec.js

var Browser, assert, browser, url, title;

assert = require('assert');
Browser = require('zombie');

var google = "https://google.com"
var google_title = "Google"

url = google
title = google_title

browser = new Browser();

describe('home page', function() {

    describe('title', function() {
      it('should have a title', function(done) {
        browser.visit(url).then(function() {
          assert.equal(browser.text('title'), title);
          done();
        }).fail(function(err) {
          console.log('Failed with error: ', error);
          done(err);
        });
      });
    });
});

此文件位于spec/中,因此我运行了以下命令:

jasmine-node spec/

结果:

F

Failures:

  1) home page title should have a title
   Message:
     TypeError: Object [object Promise] has no method 'fail'
   Stacktrace:
     TypeError: Object [object Promise] has no method 'fail'
    at null.<anonymous> (/home/dmmmd/Dropbox/node_js_projects/affinity-zombie/spec/sample_zombie_spec.js:21:12)
    at null.<anonymous> (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/async-callback.js:45:37)
    at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)

Finished in 0.12 seconds
1 test, 1 assertion, 1 failure, 0 skipped

我在另一台机器上尝试了完全相同的事情:

工具

  • Darwin 14.3.0 Darwin Kernel Version 14.3.0
  • io.js v1.8.1
  • zombie Version 4.0.7 2015-04-10
  • jasmine-node 1.14.3

结果:

F

Failures:

 1) home page title should have a title
  Message:
    TypeError: undefined is not a function
  Stacktrace:
    TypeError: undefined is not a function
   at null.<anonymous> (/Users/dmmmd/Dropbox/node_js_projects/spec/sample_zombie_spec.js:21:12)
   at null.<anonymous> (/usr/local/lib/node_modules/jasmine-node/lib/jasmine-node/async-callback.js:45:37)
   at Timer.listOnTimeout (timers.js:89:15)

Finished in 0.069 seconds
1 test, 1 assertion, 1 failure, 0 skipped

我也尝试了其他一些网址,即使是本地网站也没有成功。

JavaScript,node.js,io.js,zombie和jasmine对我来说都是新手,所以我基本上只是从文档和stackoverflow问题中了解食谱。我将不胜感激任何建议。我怀疑我错过了一些非常简单的事情。

感谢。

0 个答案:

没有答案