我安装了Windows10-64,Firefox 61.0.2,Java。我正在使用selenium-grid和selenium-server-独立-3.11.0.jar和geckodriver21.0执行我的测试,但是当我运行它时,测试会显示以下错误:
org.openqa.selenium.WebDriverException:错误转发新会话找不到:功能{acceptInsecureCerts: true,browserName: firefox,platform: WINDOWS,version: 61.0.2}
我的代码:
private void createBrowserInstance() throws MalformedURLException {
switch (environmentHandler.getTestBrowser().toLowerCase()) {
case "firefox":
FirefoxOptions firefox = new FirefoxOptions();
firefox.setCapability("marionette", false);
browCapab = DesiredCapabilities.firefox();
browCapab.setBrowserName("firefox");
browCapab.setPlatform(Platform.WINDOWS);
browCapab.setVersion("61.0.2");发布于 2018-09-04 03:03:56
Error forwarding the new session cannot find是网格告诉您的方式,它无法找到与您所请求的功能匹配的节点。
网格使用以下4个属性进行功能匹配,以匹配测试用例中请求的功能和节点必须提供的实际功能
您还没有提到如何启动节点。具体而言,您没有提到是否使用节点配置JSON文件(此配置文件通常用于调整节点支持的功能等)。但我想你不是在用。
当您在没有任何额外定制的情况下启动节点时,它就不知道version功能了。
因此,它可能有一个可以支持firefox on windows的节点。但是您的测试是寻找运行在firefox version 61.0.2上的windows。这就解释了错误。
要解决此问题,可以执行以下操作之一:
browCapab.setVersion("61.0.2");行发布于 2018-09-04 08:04:34
这个错误信息..。
org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : Capabilities {acceptInsecureCerts: true, browserName: firefox, platform: WINDOWS, version: 61.0.2}...implies表示GeckoDriver无法转发新会话。
您的主要问题是您正在使用的配置中的incompatibility,如下所示:
selenium-server-standalone-3.11.0.jargeckodriver 21.0
- You can leave the capability **marionette** untouched as by default `marionette` is set to **True**.
- You can also specify the capability **marionette** as follows:FirefoxOptions firefox_options =新FirefoxOptions();firefox_options.setCapability("marionette",true);
browserName:如果值不是匹配功能中的"browserName“条目的字符串,则使用数据null返回成功。browserVersion:使用实现定义的比较算法将值与匹配功能中的"browserVersion“条目进行比较。比较是接受一个使用"<“、"<=”、">“和">=”运算符对版本施加约束的值。如果这两个值不匹配,则使用数据null返回成功。platformName:如果值不是匹配功能中的"platformName“条目的字符串,则使用数据null返回成功。
https://stackoverflow.com/questions/52155182
复制相似问题