使用WebDriverJS运行Mocha测试时超时



我正在尝试在Windows机器上运行此程序,并不断获得超时。我有硒运行,但它似乎无法实现连接到URL。

var client = require('webdriverjs').remote({
    desiredCapabilities: {
        browserName: 'chrome'
    },
    logLevel: 'verbose'
});
var expect = require('chai').expect;

describe('Test example.com', function(){
    before(function(done) {
        client.init().url('http://example.com', done);
    });
    describe('Check homepage', function(){
     it('should see the correct title', function(done) {
        client.getTitle(function(err, title){
            expect(title).to.have.string('Example Domain');
            done();
        });
    });
    });
    after(function(done) {
        client.end();
        done();
    });
});

这是我收到的错误:

  1) Test example.com "before all" hook:
     Error: timeout of 10000ms exceeded
      at null.<anonymous> (C:Userssandy_000AppDataRoamingnpmnode_modulesm
ochalibrunnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

我找到了这个网站:http://aboutcode.net/2013/12/02/automating-chrome-on-windows-with-javascript-using-selenium-webdriverjs.html

我需要下载相关的可执行驱动程序,并像这样启动selenium:

c:myproject>java -jar selenium-server-standalone-2.35.0.jar -Dwebdriver.chrome.driver=chromedriver.exe

最新更新