0

我正在尝试在 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)
4

1 回答 1

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
于 2014-05-07T16:02:58.997 回答