gpt4 book ai didi

java - 出现错误 org.openqa.selenium.WebDriverException : Error forwarding the new session Empty pool of VM for setup Capabilities for firefox

转载 作者:行者123 更新时间:2023-12-02 00:33:52 24 4
gpt4 key购买 nike

我正在使用: java :1.8 Selenium :3.141.59 jar Geco驱动程序版本:0.25.0火狐版本: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

Configuration of Grid Hub and node

下面是代码:

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: Error forwarding the new session Empty pool of VM for setup Capabilities {acceptInsecureCerts: true, browserName: firefox, marionette: true, platform: WIN10, version: } Command duration or timeout: 801 milliseconds Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: host: 'GP-PIN-IS04', ip: '192.168.250.72', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_221' Driver info: driver.version: RemoteWebDriver Caused by: org.openqa.grid.common.exception.GridException: Error forwarding the new session Empty pool of VM for setup Capabilities {acceptInsecureCerts: true, browserName: firefox,

最佳答案

因此,您的错误显示“错误转发新 session ,用于设置功能的虚拟机池为空”,这意味着它正在寻找与您在创建远程驱动程序时要求的功能相匹配的节点,但找不到。在启动 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>"
}

关于java - 出现错误 org.openqa.selenium.WebDriverException : Error forwarding the new session Empty pool of VM for setup Capabilities for firefox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57992406/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com