我正在尝试使用Cucumber在硒网格上进行POC。我收到此错误:错误转发新会话用于设置功能的VM清空池
这是我的示例代码:
public static void configureServer(){
GridHubConfiguration gridHubConfig = new GridHubConfiguration();
//gridHubConfig.role = "hub";
gridHubConfig.host = "127.0.0.1";
gridHubConfig.port = 4444;
gridHubConfig.newSessionWaitTimeout = 150000;
Hub myHub = new Hub(gridHubConfig);
myHub.start();
GridNodeConfiguration gridNodeConfig = new GridNodeConfiguration();
gridNodeConfig.hub = "http://127.0.0.1:4444/grid/register";
gridNodeConfig.host = "xxxx"; //my ip address
gridNodeConfig.port = 5566;
gridNodeConfig.role = "webdriver";
RegistrationRequest req = RegistrationRequest.build(gridNodeConfig);
req.getConfiguration();
req.validate();
RegistrationRequest.build(gridNodeConfig);
SelfRegisteringRemote remote = new SelfRegisteringRemote(req);
remote.setRemoteServer(new SeleniumServer(gridNodeConfig));
remote.startRemoteServer();
remote.startRegistrationProcess();
System.out.println("Node Registered to Hub..............");
}
能力:
capabilities.setBrowserName("chrome");
capabilities.setPlatform(Platform.MOJAVE);
capabilities.setVersion("91.0.4472.114");
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
驱动程序初始化:
HubNodeConfiguration.configureServer();
System.setProperty("webdriver.chrome.driver","xxx/chromedriver");
threadLocalDriver.set(new RemoteWebDriver(new URL("http://localhost:9090
/wd/hub"),capabilities));
我已经尝试并遵循了这里提供的答案(Selenium Grid Error forwarding the new session Empty pool of VM for setup Capabilities),但没有成功
有关详细代码,请参阅我的Git Repo:https://github.com/rkhanna1401/cucumber_selenium_grid
您的代码存在多个问题。简而言之,您只是在创建WebDriver时使用的所需功能对象中硬编码了许多操作系统平台信息,但Grid Hub没有这些更改。
我还注意到您的代码库试图与运行在不同端口的集线器通信,但您的集线器运行在不同的端口。
我还注意到,您的测试代码没有等待节点注册到中心。作为一个快速黑客,我添加了一个睡眠来促进这一点,但您可以使用复杂的机制,例如轮询中心以查看节点是否已注册等。,
您需要使用下面的git diff内容创建一个补丁文件,然后您可以将其应用于您的代码库。
这里有一个git diff,您可以将其应用到您的项目中以解决问题
From 7d718cea160e7feac2fab8526f8578553d697426 Mon Sep 17 00:00:00 2001
From: Krishnan Mahadevan <Krishnan.Mahadevan>
Date: Sat, 26 Jun 2021 19:46:33 +0530
Subject: [PATCH] Changes needed
---
.../java/WebdriverBase/GridDriverManager.java | 15 +++++----------
.../java/WebdriverBase/HubNodeConfiguration.java | 12 +++++++++---
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/src/main/java/WebdriverBase/GridDriverManager.java b/src/main/java/WebdriverBase/GridDriverManager.java
index 58a8052..4102ac3 100644
--- a/src/main/java/WebdriverBase/GridDriverManager.java
+++ b/src/main/java/WebdriverBase/GridDriverManager.java
@@ -96,7 +96,7 @@ public class GridDriverManager {
}
if (browserType.equalsIgnoreCase("Chrome")) {
try {
- System.setProperty("webdriver.chrome.driver","/Users/rishikhanna/Documents/cucumber/shopping/Driver/chromedriver");
+// System.setProperty("webdriver.chrome.driver","/Users/rishikhanna/Documents/cucumber/shopping/Driver/chromedriver");
} catch (Exception e) {
e.printStackTrace();
}
@@ -112,9 +112,8 @@ public class GridDriverManager {
// chromePrefs.put("profile.default_content_settings.popups", 0);
// ChromeOptions options = new ChromeOptions();
// options.setExperimentalOption("prefs", chromePrefs);
- capabilities.setBrowserName("chrome");
- capabilities.setPlatform(Platform.MOJAVE);
- capabilities.setVersion("91.0.4472.114");
+
+ capabilities.merge(DesiredCapabilities.chrome());
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
// capabilities.setCapability(ChromeOptions.CAPABILITY, options);
}
@@ -130,9 +129,6 @@ public class GridDriverManager {
if (platformType.equalsIgnoreCase("WINDOWS")) {
capabilities.setPlatform(Platform.WINDOWS);
}
- if (platformType.equalsIgnoreCase("MAC")) {
- capabilities.setPlatform(Platform.MOJAVE);
- }
//capabilities.setVersion(getValFromJson(jsonObject,"version"));
return capabilities;
@@ -149,7 +145,7 @@ public class GridDriverManager {
// TODO Auto-generated catch block
e.printStackTrace();
}
- setDriver("chrome", "WINDOWS");
+ setDriver("chrome", "MAC");
return threadLocalDriver.get();
}
@@ -159,8 +155,7 @@ public class GridDriverManager {
{
try {
HubNodeConfiguration.configureServer();
- System.setProperty("webdriver.chrome.driver","/Users/rishikhanna/Documents/cucumber/shopping/Driver/chromedriver");
- threadLocalDriver.set(new RemoteWebDriver(new URL("http://localhost:9090/wd/hub"),capabilities));
+ threadLocalDriver.set(new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),capabilities));
threadLocalDriver.get().manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
} catch (MalformedURLException e) {
e.printStackTrace();
diff --git a/src/main/java/WebdriverBase/HubNodeConfiguration.java b/src/main/java/WebdriverBase/HubNodeConfiguration.java
index 174b216..2725bba 100644
--- a/src/main/java/WebdriverBase/HubNodeConfiguration.java
+++ b/src/main/java/WebdriverBase/HubNodeConfiguration.java
@@ -4,6 +4,7 @@ import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.concurrent.TimeUnit;
import org.openqa.grid.common.GridRole;
import org.openqa.grid.common.RegistrationRequest;
import org.openqa.grid.internal.utils.SelfRegisteringRemote;
@@ -30,10 +31,10 @@ public class HubNodeConfiguration {
myHub.start();
GridNodeConfiguration gridNodeConfig = new GridNodeConfiguration();
- gridNodeConfig.hub = "http://127.0.0.1:4444/grid/register";
- gridNodeConfig.host = "xxxx"; //my ip address
+ gridNodeConfig.hub = "http://localhost:4444";
+ gridNodeConfig.host = "localhost"; //my ip address
gridNodeConfig.port = 5566;
- gridNodeConfig.role = "webdriver";
+ gridNodeConfig.role = "node";
RegistrationRequest req = RegistrationRequest.build(gridNodeConfig);
req.getConfiguration();
req.validate();
@@ -44,6 +45,11 @@ public class HubNodeConfiguration {
remote.startRemoteServer();
remote.startRegistrationProcess();
+ try {
+ TimeUnit.SECONDS.sleep(10);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
System.out.println("Node Registered to Hub..............");
}
}
--
2.24.3 (Apple Git-128)+GitX
我正在硒网格上尝试。我收到这个错误: 转发新会话时出错为设置功能清空VM池[{BrowserName=chrome, version=47, Platform=WIN8_1}] 代码如下:
我尝试从页面使用Selenium Grid Extras:https://github.com/groupon/Selenium-Grid-Extras 我成功地在我的私人机器上使用了它。配置之后,我运行了命令“java-jar Selenium Grid Extras jar.jar”(https://ibb.co/j4wZPH),我可以通过转到地址来查看节点http://localhost:4
我正在使用:Java:1.8 Selenium:3.141.59 jar Geco驱动程序版本:0.25.0 Firefox版本:69.0.1 在运行代码时获得以下异常日志: org.openqa.selenium.WebDriverException:为安装功能转发VM的新会话空池时出错{AcceptinSecureCerts:true,BrowserName:firefox,Marionett
我的selenium配置有问题。我正在尝试在iOS和Android上自动化Selenium测试。 iOS测试独立于iOS驱动程序正常运行。Android测试也在独立正常运行。 但是当我想运行iOS和Android时,我遇到了问题! 对于我的Android测试,我正在运行这个命令,一切都很好: 但是,当我想要集成iOS测试时,我会按照以下指南更改此命令的端口:http://selendroid.io
我创建了图像和容器,尝试启动容器,它抛出以下错误: 来自守护程序的错误响应: hcsshim::创建计算机系统 8459c6c816e764642634ce29cfee666d30834df0f2792fba9e411d11bd0c33f6:虚拟机无法启动,因为未安装所需的功能 我正在使用具有以下配置的视窗虚拟机:
前面小节介绍了 Linux 和 GUN 项目,本小节开始学习如何在 Windows 上安装虚拟机,虚拟机安装之后可以在虚拟机中安装 Linux 相关的操作系统,常见的虚拟机软件有 VirtualBox、VMware 等等,本教程使用 VMware 虚拟机软件来演示如何安装 VMware 虚拟机: 1. 下载 VMware 来到官网下载 Windows 版本 VMware 安装程序,如图所示选择合适