[英]How to solve org.openqa.selenium.SessionNotCreatedException selenium grid 3
I am using selenium 3.2.0 standalone, chrome latest version and chrome driver latest version which is giving not able to connect exemption on running. 我使用的是selenium 3.2.0独立版本,chrome最新版本和chrome驱动程序最新版本,这使得运行时无法连接豁免。
Issue is with chrome driver please help chrome驱动程序有问题,请帮忙
org.openqa.selenium.SessionNotCreatedException:
my code look like this: 我的代码如下所示:
System.setProperty("webdriver.chrome.driver","E:/WorkSpace/Econsys_Auto/Jarfiles/chromedriver.exe");
System.setProperty("webdriver.chrome.driver","E:/WorkSpace/Econsys_Auto/Jarfiles/chromedriver.exe");
DesiredCapabilities capabilities=DesiredCapabilities.chrome();
capabilities.setBrowserName("chrome");
capabilities.setPlatform(Platform.XP);
System.out.println("*******");
driver = new RemoteWebDriver(new URL(nodeUrl), capabilities);
driver.get(baseUrl);
Got selenium 3.2.0 with chromedriver 2.28, but I got Win10. 使用chromedriver 2.28获得了硒3.2.0,但是我得到了Win10。
Try this code: 试试这个代码:
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");//use your path
try{
driver = new ChromeDriver();
}
catch (Exception e) {
System.out.println(e);
}
I would suggest that you please try again using Selenium 3.3.0 (which is released just now) 我建议您请使用Selenium 3.3.0(刚刚发布)重试。
There was an issue in Selenium (versions previous to 3.3.0) which was preventing the actual reason for the new session failure from being relayed to the test. Selenium中存在一个问题(3.3.0之前的版本),该问题阻止了新会话失败的实际原因传递给测试。 That explains why you are not able to identify the root cause. 这就解释了为什么您无法确定根本原因。
This now stands fixed in Selenium 3.3.0 as part of this commit 现在, 此硒在Selenium 3.3.0中已修复,是此提交的一部分
Now coming back to the possible reasons why your tests are not spawning a chrome browser. 现在回到测试未生成chrome浏览器的可能原因。
I notice that you are using 我注意到您正在使用
System.setProperty("webdriver.chrome.driver","E:/WorkSpace/Econsys_Auto/Jarfiles/chromedriver.exe");
in your test code. 在您的测试代码中。 This sets up the JVM argument webdriver.chrome.driver
ONLY for the current JVM. 这webdriver.chrome.driver
当前JVM设置JVM参数webdriver.chrome.driver
。 The Grid and the node are running in a different JVM (remember you spawned them using java -jar
command ?). 网格和节点在不同的JVM中运行(请记住您是使用java -jar
命令生成的)。
I would instead recommend that you add "E:/WorkSpace/Econsys_Auto/Jarfiles/" to your PATH
variable. 相反,我建议您将“ E:/ WorkSpace / Econsys_Auto / Jarfiles /”添加到PATH
变量中。 This is a one time exercise you would be doing on a "per machine" basis and this will ensure that Selenium finds the chromedriver
binary's location (I think that's why your tests are failing and you should be able to confirm this, if you looked at the node's console logs) 这是一次您将在“每台机器”的基础上进行的练习,这将确保Selenium找到chromedriver
二进制文件的位置(我认为这就是测试失败的原因,并且如果您查看了,您应该能够确认这一点。节点的控制台日志)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.