【问题标题】:SessionNotCreatedException: Unable to find a matching set of capabilities using SeleniumGrid with GeckoDriver Firefox through JavaSessionNotCreatedException:无法通过 Java 使用 SeleniumGrid 和 GeckoDriver Firefox 找到一组匹配的功能
【发布时间】:2019-09-07 11:50:37
【问题描述】:

下面我编写的代码是在 selenium 独立网格环境下打开 www.google.com。在执行期间它显示错误

配置:

  • 操作系统:WINDOWS 10
  • 浏览器:FireFox (66.0.3)
  • Selenium 独立命令:

    java -Dwebdriver.gecko.driver=C:\eClipse\jar\Selenium\geckodriver\geckodriver.exe -jar selenium-server-standalone-3.141.59.jar -role standalone 
    

错误:

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'QAT2', ip: '10.1.6.79', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'
Driver info: driver.version: unknown

我尝试用谷歌搜索这个异常,但没有找到任何解决它的线索。我有什么解决办法吗?

代码:

public class GridSetup {

private String baseUrl ;
private String nodeURL ;
public WebDriver wDriver ; 

public static void main() throws MalformedURLException{
baseUrl = "http://www.google.com";
nodeURL = "http://localhost:4444/wd/hub";    
System.setProperty("webdriver.gecko.driver","C:\\eClipse    \\geckodriver.exe");
DesiredCapabilities caps = DesiredCapabilities.firefox();       
System.out.println( "#####################");
caps.setBrowserName("firefox");
caps.setCapability("marioneete", true);
caps.setPlatform(Platform.WIN10);
caps.setVersion("66.0.3");

wDriver = new RemoteWebDriver(new URL(nodeURL), caps);
wDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
wDriver.get(baseUrl);
} 

}

【问题讨论】:

  • 任何一种解决方案...?

标签: java firefox selenium-webdriver selenium-grid geckodriver


【解决方案1】:

此错误消息...

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities 
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' 
System info: host: 'QAT2', ip: '10.1.6.79', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91' 
Driver info: driver.version: unknown

...暗示 GeckoDriver 无法启动/产生新的 WebBrowsing 会话,即 Firefox 浏览器 会话。

您的主要问题是您使用的二进制文件版本之间的不兼容性,如下所示:

  • 您的 Selenium 客户端 版本是 3.141.59
  • 您的 JDK 版本1.8.0_91,非常古老。

所以 JDK v8u91Selenium Client v3.141.59 之间存在明显的不匹配。


解决方案

JDK升级到最新级别JDK 8u202

【讨论】:

    猜你喜欢
    • 2019-01-30
    • 2018-07-30
    • 1970-01-01
    • 2020-07-30
    • 2020-04-28
    • 2018-05-26
    • 2017-11-30
    • 2018-09-22
    相关资源
    最近更新 更多