H.C
H.C

Reputation: 21

"Jenkins + Selenium Grid + Maven" ERROR: org.openqa.selenium.SessionNotCreatedException:

I am using Jenkins with Selenium Grid. I do not launch my hub & node through command line, but totally through Jenkins UI - this is one of the reasons I am desperate for a solution through UI config instead of command line solutions.
I can see my node as running with "JVM Options" as "webdriver.ie.driver=C:\Program Files (x86)\Jenkins" . I have ensured my "IEDriverServer.exe" is stored at this folder.

Here's the image with config of my grid - Grid Configuration

I have used 64-bit IEDriverServer (version 3.150.1)
Selenium Grid version 3.141.59

My code:

DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setBrowserName("internet explorer");
capabilities.setPlatform(Platform.XP);
capabilities.setVersion("11");

driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capabilities);

For job configuration, under "Build Environment", I have set "Goal and options" as "clean test" since this is a maven project.
Everytime I build this job, I get this error:

org.openqa.selenium.SessionNotCreatedException: 
Unable to create new service: InternetExplorerDriverService
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'WINDOWS-JENKINS', ip: '10.162.0.5', os.name: 'Windows Server 2016', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_144'
Driver info: driver.version: unknown
Command duration or timeout: 344 milliseconds
    at qa.BH.Setup.Init(Setup.java:34)
Caused by: org.openqa.selenium.SessionNotCreatedException: 
Unable to create new service: InternetExplorerDriverService
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'WINDOWS-JENKINS', ip: '10.162.0.5', os.name: 'Windows Server 2016', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_144'
Driver info: driver.version: unknown
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'WINDOWS-JENKINS', ip: '10.162.0.5', os.name: 'Windows Server 2019', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_231'
Driver info: driver.version: unknown


I understand it is not able to correctly match IEDriver? driver.version : unknown


Help Please?

Upvotes: 1

Views: 244

Answers (1)

H.C
H.C

Reputation: 21

For anyone else stuck with this, here's what I had to do. Thanks to the many people whose posts allowed me to gather the root cause and the fixes.

IE just does not work with the typical node on Jenkins when it's run as a service!

So, I HAD to start the agent and hub through command line.
The agent needs to be started using JNLP. Steps are-
1. Create a node as you would normally do in Jenkins. Make sure you use the option "launch agent by connecting it to the master" while creating this. If the option is not visible, you need to enable a setting under Manage Jenkins > Configure Global Security > Agents > TCP port for inbound agents. You can give a fixed port number here. Let's say the name given to the node by you is "NODE_01".
2. Once saved, you will be shown a page which gives the command to run this through command line. Something like java -jar agent.jar -jnlpUrl http://localhost:8080/computer/Node_01/slave-agent.jnlp -secret 30541e5f10d2b8b7054bcf3d99ef7798b9c99e698ade13444179b168cebf1b97 -workDir "C:\Program Files (x86)\Jenkins"
3. Download this "agent.jar" from here (it must be a hyperlink).
4. Go to that folder in command prompt and run the above command.
5. Now for the hub -
6. Open another command prompt, go to the folder where you have your selenium-server-standalone jar file saved (Download now if you haven't so far) and run this - java -Dwebdriver.ie.driver="C:\Program Files (x86)\Jenkins\IEDriverServer.exe" -jar selenium-server-standalone-3.141.59.jar -role node -hub "http://localhost:4444/grid/register/"
Note that my IEDriverServer.exe path may be different to yours.

You are good to go now! Create a job and run it.

Upvotes: 1

Related Questions