【发布时间】:2018-12-12 17:47:45
【问题描述】:
这几天我一直在努力解决这个问题。我无法在 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
我想知道是什么原因导致两个 ChromeDrivers 启动,而第二个总是在端口 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();
}
我已经尝试了您可以在 Google 或此处在 Stack 上找到的所有内容。没有什么帮助。任何建议将不胜感激。提前致谢。
【问题讨论】:
-
据我所知,原因可能是您使用的端口已被使用。所以尝试为节点机器提供一些其他端口号。
-
ChromeDriver 总是在可用端口上启动。任何线索为什么它会启动两次?
-
Tylko jedno u┐ycie ka┐dego adresu gniazda (protokˇ│/adres sieciowy/port) jest normalnie dozwolone.是什么意思? -
表示只允许使用一种端口。但是在测试开始之前,端口 9515 没有被使用,也没有运行 chromedriver。
标签: google-chrome selenium grid selenium-chromedriver remotewebdriver