selenium - 无法创建新的远程 session 。所需功能 = 功能 [{browserName=chrome, version=55.0.2, platform=WINDOWS}]

标签 selenium google-chrome webdriver selenium-chromedriver selenium-grid

我已经设置了一个 Selenium 网格中心和节点。在我的 java 中,我这样设置我的功能:

Login.capability = DesiredCapabilities.chrome();
Login.capability.setVersion("55.0.2");
Login.capability.setBrowserName("chrome");
Login.capability.setPlatform(org.openqa.selenium.Platform.WINDOWS);
Login.driver = new RemoteWebDriver(new URL("http://xxx.xxx.xxx.xxx/wd/hub"), Login.capability);   

当我开始构建时,我收到此错误消息:

Unable to create new remote session. desired capabilities = Capabilities [{browserName=chrome, version=55.0.2, platform=WINDOWS}], required capabilities = Capabilities [{}]

集线器输出:

selenium grid no capabilities found in request

节点输出如下:

16:23:13.323 INFO [ActiveSessionFactory.apply] - Capabilities are: {
  "browserName": "chrome",
  "goog:chromeOptions": {
  },
  "platform": "WINDOWS",
  "version": "55.0.2"
}
16:23:13.324 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5) on port XXXXXXXXX
Only local connections are allowed.

看来节点工作正常,但为什么集线器在日志中显示没有功能?

最佳答案

此错误消息...

Unable to create new remote session. desired capabilities = Capabilities [{browserName=chrome, version=55.0.2, platform=WINDOWS}], required capabilities = Capabilities [{}]

...意味着 ChromeDriver 无法启动/生成新的 WebBrowser,即 Chrome 浏览器 session 。

根据您的代码试验,您已将 Chrome 浏览器版本设置为 55.0.2。因此,您需要确保 Selenium Node 客户端安装了 Chrome 浏览器 v55.0.2

从另一个角度来看:

  • 您使用的是 ChromeDriver 2.42
  • ChromeDriver 2.42 的发行说明明确提到以下内容:

Supports Chrome v68-70

因此,ChromeDriver v2.42Chrome 浏览器 v55.0.2 之间存在明显的不匹配

解决方案

作为解决方案,您需要:

关于selenium - 无法创建新的远程 session 。所需功能 = 功能 [{browserName=chrome, version=55.0.2, platform=WINDOWS}],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52389143/

相关文章:

java.lang.OutOfMemory错误: unable to create new native thread executing Selenium WebDriver based tests using Selenium and Java

c# - 从 Selenium.Webdriver 2.44 更新到 2.46 导致 NullReferenceException

google-chrome - Chrome 开发工具中的新调试图标 "Step F9"

C++:2 + x + 1 与 3 + x 相同吗?

java - 尝试通过 Selenium 和 Java 使用 sendKeys 时获取验证消息

Python:通过 href 查找元素

Selenium Webdriver 无法获取 Modal 中的元素

selenium - 在 Xpath 中使用 OR 条件来标识相同的元素

javascript - 如何在 chrome 控制台中使用 let 等 ES6 语法?

python - 有谁在 iOS 上成功安装了 Selenium 吗?