简体   繁体   中英

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.
Issue is with chrome driver please help

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.

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)

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. 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

Now coming back to the possible reasons why your tests are not spawning a chrome browser.

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. The Grid and the node are running in a different JVM (remember you spawned them using java -jar command ?).

I would instead recommend that you add "E:/WorkSpace/Econsys_Auto/Jarfiles/" to your PATH variable. 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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM