I am getting org.openqa.selenium.SessionNotCreatedException exception when trying to create driver through Selenium standalone jar 3.14.
I have used below commands to start hub and node
1) java -jar selenium-server-standalone-3.141.59.jar -role hub
2) java -jar selenium-server-standalone-3.141.59.jar -role webdriver -hub http://192.xxx.xx.xxx:4444/grid/register -port 5556 -browser browserName=chrome,maxInstance=3 -browser browserName=firefox,maxInstance=3
Trying to create driver through below code
System.setProperty("webdriver.gecko.driver",
System.getProperty("user.dir") + "/drivers/" +"geckodriver");
DesiredCapabilities caps = DesiredCapabilities.firefox();
caps.setBrowserName("firefox");
caps.setPlatform(Platform.LINUX);
caps.setVersion("64.0");
driver = new RemoteWebDriver(new URL("http://192.xxx.xx.xxx:4444/wd/hub"),caps);
I am getting below exception:
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{browserName=firefox, moz:firefoxOptions={binary=Optional.empty, args=[], legacy=null, logLevel=null, prefs={}, profile=null}, platform=LINUX}], required capabilities = Capabilities [{}]
Build info: version: '3.3.1', revision: '5234b325d5', time: '2017-03-10 09:10:29 +0000'
System info: host: 'HP-ProBook-440-G5', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-43-generic', java.version: '1.8.0_181'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:158)
at com.jio.web.base.TestBase.initDriver(TestBase.java:290)
at com.jio.web.base.Setup.assignDriver(Setup.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:514)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:215)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:178)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.run(TestNG.java:1064)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
-
Only exception won't help us as it is a part of the error which you have mis-configured. You need to provide us the version info programatically (preferably through CLI)undetected Selenium– undetected Selenium01/15/2019 12:24:32Commented Jan 15, 2019 at 12:24
1 Answer 1
As your Selenium Grid Node is using geckodriver to communicate with the Selenium Grid Hub, so you need to initiate the Selenium Grid Node with the absolute location of the geckodriver as follows:
java -Dwebdriver.gecko.driver=/path/to/geckodriver -jar selenium-server-standalone-3.141.59.jar -role webdriver -hub http://192.xxx.xx.xxx:4444/grid/register -port 5556 -browser browserName=chrome,maxInstance=3 -browser browserName=firefox,maxInstance=3
-
1I tried this also but still getting same issue org.openqa.selenium.SessionNotCreatedException: Error forwarding the new session cannot find : Capabilities {browserName: firefox, marionette: true, platform: LINUX, version: 64.0}Deolas– Deolas01/15/2019 11:06:11Commented Jan 15, 2019 at 11:06
-
Update the question with browserName, platform and version information along with the commands you have used to start the Hub and Nodeundetected Selenium– undetected Selenium01/15/2019 11:38:34Commented Jan 15, 2019 at 11:38
-
if Suppose there are 20 node then do we have to pass the path of gecko.driver on each node ? I have a scenario where I have to execute the test case on IE,FF, Chrome of each node from selenium hub ?jitendra gupta– jitendra gupta02/10/2020 08:13:41Commented Feb 10, 2020 at 8:13
-
@jitendragupta You can pass multiple variants of WebDriver.undetected Selenium– undetected Selenium02/10/2020 08:29:59Commented Feb 10, 2020 at 8:29
Explore related questions
See similar questions with these tags.