当前位置: 首页 > 知识库问答 >
问题:

获取错误org.openqa.selenium.WebDriverException:转发firefox安装功能的VM的新会话空池时出错

益源
2023-03-14

我正在使用:Java:1.8 Selenium:3.141.59 jar Geco驱动程序版本:0.25.0 Firefox版本:69.0.1

start java -jar C:/eclipse-workspace/Selenium_Grid/Config/selenium-server-standalone-3.141.59.jar -role hub

start java -Dwebdriver.chrome.driver=D:/Selenium/chromedriver_win32/chromedriver.exe -jar C:/eclipse-workspace/Selenium_Grid/Config/selenium-server-standalone-3.141.59.jar -role node -hub http://localhost:4444/grid/register -port 5558 -maxSession 5 -browser browserName=chrome,maxInstances=10 

start java -Dwebdriver.gecko.driver=D:/Selenium/geckodriver-v0.25.0-win64/geckodriver.exe -jar C:/eclipse-workspace/Selenium_Grid/Config/selenium-server-standalone-3.141.59.jar -role node -hub http://localhost:4444/grid/register -port 5559 -maxSession 5

public static RemoteWebDriver getBrowserDriver(final String browser)
        throws MalformedURLException {
    return new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),
            getBrowserCapabilities(browser));
}

private static DesiredCapabilities getBrowserCapabilities(
        final String browserType) throws MalformedURLException {
    switch (browserType.toLowerCase()) {
    case "firefox":
        System.out.println("Opening firefox driver");
        DesiredCapabilities capabilities = DesiredCapabilities.firefox();
        capabilities.setBrowserName("firefox");
        capabilities.setPlatform(Platform.WIN10);       
        return capabilities;
    }
}

在运行代码时获得以下异常日志

org.openqa.selenium.WebDriverException:为安装功能转发VM的新会话空池时出错{AcceptinSecureCerts:true,BrowserName:firefox,Marionette:true,Platform:WIN10,Version:}命令持续时间或超时:801毫秒构建信息:版本:“3.141.59”,修订:“E82BE7D358”,时间:“2018-11-14T08:25:48”系统信息:主机:“GP-PIN-IS04”,IP:“192.168.250.72”,OS.Name:“Windows 10”,OS.ARCH:“AMD64”,

共有1个答案

花健
2023-03-14

因此,您的错误显示为“error forwarding the new session Empty pool of VM for setup capabilities”,这意味着它正在寻找一个与您创建远程驱动程序时要求的功能匹配的节点,但它找不到一个。在启动geckodriver的一行中,您不需要像为chrome那样指定浏览器。创建一个节点配置文件并在启动节点时传递它可能会更容易,如下所示:

java -Dwebdirver.gecko.driver="D:/Selenium/geckodriver-v0.25.0-win64/geckodriver.exe" -jar selenium-server-standalone-3.8.1.jar -role node -hub "http://localhost:4444/grid/register/" -port 5559 -nodeConfig config.json

firefox节点的配置文件如下所示:

 {
 "capabilities": [
   {
     "browserName": "firefox",
     "platform": "WIN10",
     "maxInstances": 5
   }      
 ],
 "hub": "http://<hub ip>:<hub port>"
 }
 类似资料: