无法在 Selenium Grid 中创建 Chrome RemoteWebDriver
Can't create Chrome RemoteWebDriver in Selenium Grid
几天来我一直在为这个问题苦苦挣扎。我无法在 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] - 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] - 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
我想知道是什么原因导致两个 Chrome 驱动程序启动,而第二个总是在端口 9515 上启动。我正在使用 Chrome v67 和驱动程序 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 上找到的所有内容。没有任何帮助。任何建议将不胜感激。提前致谢。
此问题的解决方案是传递 chrome驱动程序路径,如下所示
java-罐子-Dwebdriver.chrome.driver=/Users/UserName/Desktop/chromedriver24
selenium-server-standalone-3.13.0.jar -role node -hub
http://localhost:4444/grid/register -浏览器 browserName=chrome,maxInstances=3
而不是使用参数 chrome_binary
几天来我一直在为这个问题苦苦挣扎。我无法在 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] - 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] - 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
我想知道是什么原因导致两个 Chrome 驱动程序启动,而第二个总是在端口 9515 上启动。我正在使用 Chrome v67 和驱动程序 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 上找到的所有内容。没有任何帮助。任何建议将不胜感激。提前致谢。
此问题的解决方案是传递 chrome驱动程序路径,如下所示
java-罐子-Dwebdriver.chrome.driver=/Users/UserName/Desktop/chromedriver24 selenium-server-standalone-3.13.0.jar -role node -hub http://localhost:4444/grid/register -浏览器 browserName=chrome,maxInstances=3
而不是使用参数 chrome_binary