我已经通过运行命令启动了 selenium 服务器集线器:java -jar selenium-server-standalone-3.141.59.jar -role hub
还通过运行以下命令成功连接节点: java -Dwebdriver.chrome.driver="E:\chromedriver.exe" -jar selenium-server-standalone-3.141.59.jar -role webdriver -hub http://10.xxx4 :4444/grid/register -port 8989
我正在运行以下代码来运行 selenium:
public class ChromeGridTest {
@Test
public void testgrid() throws MalformedURLException {
DesiredCapabilities cap= new DesiredCapabilities();
cap.setBrowserName("chrome");
cap.setPlatform(Platform.WINDOWS);
ChromeOptions opt=new ChromeOptions();
opt.addArguments("--start-maximized");
opt.merge(cap);
String HubUrl="http://10.x.x.x4:4444/wd/hub";
WebDriver driver=new RemoteWebDriver(new URL(HubUrl), opt);
driver.get("https://www.google.com");
System.out.println(driver.getTitle());
}
}
进入 Hub 控制台时出错 = INFO [RequestHandler.process] - 转发新会话时出错 转发请求时出错 无法连接到 /192.168.xx.197:8989
注意:Openvpn ip=10.xxx4 is and node pc ip=192.168.xx.197
如果有人在硒网格中使用虚拟专用网络工作,请帮助我提前感谢