本文介绍了节点selenium-webdriver“错误:在以下位置等待WebDriver服务器超时".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照入门"部分中的说明进行操作WebDriverJs文档,并在其网站上运行此代码段后:

var driver = new webdriver.Builder().
   withCapabilities(webdriver.Capabilities.chrome()).
   build();

driver.get('http://www.google.com');
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');
driver.findElement(webdriver.By.name('btnG')).click();
driver.wait(function() {
 return driver.getTitle().then(function(title) {
   return title === 'webdriver - Google Search';
 });
}, 1000);

driver.quit();

我收到此错误:

Error: Timed out waiting for the WebDriver server at http://XXX.XXX.X.XXX:60065/
    at <anonymous>
    at <anonymous>
    at <anonymous>
    at <anonymous>
    at <anonymous>
    at <anonymous>
    at <anonymous>
    at <anonymous>
    at <anonymous>
    at <anonymous>
==== async task ====
WebDriver.createSession()

我正在使用此处找到的mac32版本的ChromeDriver运行OSX Mavericks. chromedriver可执行文件位于我的/usr/local/bin目录中,并且可以在我的path上访问.

我注意到的一件事是,当我从命令行运行chromedriver时,它在端口9515上运行,而节点代码正在60065上寻找它.但是,仅使用chromedriver运行就不需要任何额外的配置.

有人会对我为什么收到此错误有任何想法吗?

解决方案

我今天和附近都有这个确切的问题,据我所知,这是当前版本的selenium-webdriver软件包(2.41.0)的错误./p>

Selenium项目存在一个错误,但是我认为该修补程序尚未进入npm.

降级到Chromedriver 2.9.248307版本对我来说很有效.

While following the instructions in the 'Getting Started' section ofthe WebDriverJs documentation and after running this snippet from their site:

var driver = new webdriver.Builder().
   withCapabilities(webdriver.Capabilities.chrome()).
   build();

driver.get('http://www.google.com');
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');
driver.findElement(webdriver.By.name('btnG')).click();
driver.wait(function() {
 return driver.getTitle().then(function(title) {
   return title === 'webdriver - Google Search';
 });
}, 1000);

driver.quit();

I'm getting this error:

Error: Timed out waiting for the WebDriver server at http://XXX.XXX.X.XXX:60065/
    at <anonymous>
    at <anonymous>
    at <anonymous>
    at <anonymous>
    at <anonymous>
    at <anonymous>
    at <anonymous>
    at <anonymous>
    at <anonymous>
    at <anonymous>
==== async task ====
WebDriver.createSession()

I'm running OSX Mavericks using the mac32 version of ChromeDriver found here. The chromedriver executable is in my /usr/local/bin directory, and is accessible on my path.

One thing I notice is that when I run chromedriver from the command line, it runs on port 9515, while the node code is looking for it on 60065. However, there shouldn't be any extra configuration required for just running with the chromedriver.

Would anyone have any ideas on why I'm getting this error?

解决方案

I was having this exact issue today and near as I can tell it's a bug with the current version of the selenium-webdriver package (2.41.0).

There is a bug filed with the Selenium project but I don't think the fix has made its way onto npm yet.

Downgrading to version 2.9.248307 of Chromedriver worked for me.

这篇关于节点selenium-webdriver“错误:在以下位置等待WebDriver服务器超时".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 12:04