无法在Selenium Grid中创建Chrome RemoteWebDriver



我已经为这个问题苦苦挣扎了几天了。我无法在Selenium Grid中使用Chrome创建RemoteWebDriver。

集线器、节点和 Eclipse(触发测试(在一台机器上运行,但我也尝试了多台机器。

我在 Eclipse 中遇到异常:

Caused by: org.openqa.selenium.WebDriverException: unknown error: DevToolsActivePort file doesn't exist

以下是节点日志的内容:

11:57:26.208 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory 
org.openqa.selenium.remote.server.ServicedSession$Factory (provider: 
org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab) 
on port 32456
Only local connections are allowed.
Starting ChromeDriver 2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab)     on port 9515
Only local connections are allowed.
11:58:26.903 INFO [ActiveSessionFactory.apply] - Capabilities are: {
"browserName": "chrome",
"goog:chromeOptions": {
"args": [
"--no-sandbox",
"--disable-dev-shm-usage",
"--log-level=DEBUG",
"--dns-prefetch-disable"
],
"extensions": [
],
"useAutomationExtension": false,
"binary": "chromedriver.exe"
}
}
11:58:26.903 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory         org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab) on port 11072
Only local connections are allowed.
Starting ChromeDriver 2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab) on port 9515
Only local connections are allowed.
[1530698307.499][SEVERE]: bind() returned an error: Tylko jedno u┐ycie ka┐dego adresu gniazda (protokˇ│/adres sieciowy/port) jest normalnie dozwolone. (0x2740)
IPv4 port not ava[i1lable. Exiting...
530698307.499][INFO]: listen on IPv4 failed with error ERR_ADDRESS_IN_USE

我想知道是什么原因导致两个 ChromeDriver 启动,第二个总是在端口 9515 上启动。我使用的是Chrome v67和Driver 2.40。

这是我的代码:

ChromeOptions options = new ChromeOptions();
options.addArguments("--no-sandbox");
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--log-level=DEBUG");
options.addArguments("--dns-prefetch-disable");
options.setExperimentalOption("useAutomationExtension", false);
try {
WebDriver rwb = new RemoteWebDriver(new URL(hubAddress), options);
return rwb;
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

我已经尝试了你在谷歌或这里,在Stack上能找到的一切。无济于事。任何建议将不胜感激。提前谢谢。

此问题的解决方案是传递如下所示的 chromedriver 路径

java -jar-dwebdriver.chrome.driver=/users/username/Desktop/chromedriver24 Selenium-server-standalone-3.13.0.jar -role node -hub http://localhost:4444/grid/register -浏览器浏览器名称=chrome,max实例=3

而不是使用参数chrome_binary

相关内容

  • 没有找到相关文章

最新更新