尝试使用WebDriverJS运行Mocha测试时超时

时间:2014-05-06 18:34:02

标签: windows webdriver mocha selenium-chromedriver webdriver-io

我正在尝试在Windows机器上运行它并继续超时。我有Selenium运行,但它似乎无法满足连接到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:\Users\sandy_000\AppData\Roaming\npm\node_modules\m
ocha\lib\runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

1 个答案:

答案 0 :(得分:0)

我找到了这个网站: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