[🐛 Bug]: Starting Selenium Hub and Node as Services
See original GitHub issueWhat happened?
In Selenium Server v3.141.59 we were able to start up Hub and Node processes as Windows Services using prunsrv.exe. We would use it to define all sorts of things, most of which I’ll show in the below code. However, in Selenium Server v 4.2.2 I can’t seem to start these up in the same way. I get an error in the logs stating the below. Can someone point me in the right direction of what the start class for Selenium Hub should be? The organization of the files on GitHub seems totally reworked between versions.
Here is what I am using in v4:
SET SERVICE_PASSWORD=ENTER_PW_HERE
SET SERVICE_ACCOUNT=SERVICE_ACCOUNT
SET PRUNSRV=C:\Selenium\prunsrv.exe
SET SELENIUM_HOME=C:\Selenium
SET SELENIUM_VERSION=ENTER_VERSION_HERE
SET SERVER_NAME=SERVER_NAME
%PRUNSRV% //IS//SeleniumHub ^
--DisplayName="SeleniumHub" ^
--Description="Selenium Hub" ^
--Install=%PRUNSRV% ^
--LogLevel=Debug ^
--StdOutput=auto ^
--StdError=auto ^
--LogPath=%SELENIUM_HOME%\Logs ^
--LogJniMessages=1 ^
--Jvm="%JAVA_HOME%\bin\client\jvm.dll" ^
--Classpath=%SELENIUM_HOME%\selenium-server-standalone-%SELENIUM_VERSION%.jar ^
--Startup=auto ^
--StartMode=jvm ^
--StartClass=org.openqa.grid.selenium.GridLauncherV3 ^
--StartMethod=main ^
--StartParams=-role#hub ^
--StartImage=%SELENIUM_HOME%\test.ico ^
--StopMode=jvm ^
--StopTimeout=60 ^
--StopImage=%SELENIUM_HOME%\test.ico ^
--JvmMs=256 ^
--JvmMx=1024 ^
--JvmSs=4000 ^
--JvmOptions=-Dprunsrv.port=8080 ^
++JvmOptions=-Dprunsrv.server=localhost
%PRUNSRV% //US//SeleniumHub --ServiceUser %SERVER_NAME%\%SERVICE_ACCOUNT% --ServicePassword %SERVICE_PASSWORD%
Here is what worked in v3:
SET SERVICE_PASSWORD=ENTER_PW_HERE
SET SERVICE_ACCOUNT=s SERVICE_ACCOUNT
SET PRUNSRV=C:\Selenium\prunsrv.exe
SET SELENIUM_HOME=C:\Selenium
%PRUNSRV% //IS//SeleniumHub ^
--DisplayName="SeleniumHub" ^
--Description="Selenium Hub" ^
--Install=%PRUNSRV% ^
--LogLevel=Debug ^
--StdOutput=auto ^
--StdError=auto ^
--LogPath=%SELENIUM_HOME%\Logs ^
--LogJniMessages=1 ^
--Jvm=%JAVA_HOME%\bin\server\jvm.dll ^
--Classpath=%SELENIUM_HOME%\selenium-server-standalone-3.141.59.jar ^
--Startup=auto ^
--StartMode=jvm ^
--StartClass=org.openqa.grid.selenium.GridLauncherV3 ^
--StartMethod=main ^
--StartParams=-role#hub ^
--StartImage=%SELENIUM_HOME%\test.ico ^
--StopMode=jvm ^
--StopTimeout=60 ^
--StopImage=%SELENIUM_HOME%\test.ico ^
--JvmMs=256 ^
--JvmMx=1024 ^
--JvmSs=4000 ^
--JvmOptions=-Dprunsrv.port=8080 ^
++JvmOptions=-Dprunsrv.server=localhost
%PRUNSRV% //US//SeleniumHub --ServiceUser SERVER_NAME\%SERVICE_ACCOUNT% --ServicePassword %SERVICE_PASSWORD%
How can we reproduce the issue?
Here are steps I have taken:
1. Using a Win 2019 VM, I install Java 8u331 JRE for both 32 and 64 bit
2. Install Chrome & Chromedriver
3. Open up ports 4444, 5555 for inbound traffic
4. Download procrun/prunsrv.exe and use .bat files to start Selenium Hub and Selenium Node services. Snippets of that are in the above.
5. Run the bat file contents in elevated `cmd` prompt
Relevant log output
[2022-06-16 11:48:05] [debug] ( javajni.c:236 ) [ 4548] loading jvm 'C:\Program Files (x86)\Java\jre1.8.0_331\bin\client\jvm.dll'
[2022-06-16 11:48:06] [debug] ( javajni.c:753 ) [ 6936] Jvm Option[0] -Dprunsrv.port=8080
[2022-06-16 11:48:06] [debug] ( javajni.c:753 ) [ 6936] Jvm Option[1] -Dprunsrv.server=localhost
[2022-06-16 11:48:06] [debug] ( javajni.c:753 ) [ 6936] Jvm Option[2] -Djava.class.path=C:\Selenium\selenium-server-standalone-4.2.2.jar
[2022-06-16 11:48:06] [debug] ( javajni.c:753 ) [ 6936] Jvm Option[3] vfprintf
[2022-06-16 11:48:06] [debug] ( javajni.c:753 ) [ 6936] Jvm Option[4] exit
[2022-06-16 11:48:06] [debug] ( javajni.c:753 ) [ 6936] Jvm Option[5] abort
[2022-06-16 11:48:06] [debug] ( javajni.c:753 ) [ 6936] Jvm Option[6] -Xms256m
[2022-06-16 11:48:06] [debug] ( javajni.c:753 ) [ 6936] Jvm Option[7] -Xmx1024m
[2022-06-16 11:48:06] [debug] ( javajni.c:753 ) [ 6936] Jvm Option[8] -Xss4000k
[2022-06-16 11:48:06] [info] ( javajni.c:497 ) [ 6936] Exception
[2022-06-16 11:48:06] [info] ( javajni.c:497 ) [ 6936] in thread "main"
[2022-06-16 11:48:06] [error] ( javajni.c:912 ) [ 6936] FindClass org/openqa/grid/selenium/GridLauncherV4 failed
Operating System
Windows Server 2019
Selenium version
4.2.2
What are the browser(s) and version(s) where you see this issue?
Chrome 102
What are the browser driver(s) and version(s) where you see this issue?
Chrome 102
Are you using Selenium Grid?
4.2.2
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Unable to start selenium grid hub - Stack Overflow
Seems the selenium-server-4.0.0.jar was corrupted or wasn't downloaded properly.
Read more >Selenium Grid Tutorial: Setup and Example of Cross Browser ...
Hi I have got an error when i was running the statement in Node machine. Exception in thread “main” java.lang.Unsupported ————— Could not...
Read more >Selenium Grid Tutorial : How to Set It Up - BrowserStack
Step 2: Start Hub It receives test requests from the client and routes them to the required nodes. To set up the Selenium...
Read more >Programmatically open Selenium Hub and Node
I'm trying to programmatically start Selenium Hub and Node, but I'm having a difficult time passing the Version. I've tried to pass through ......
Read more >How to Setup a Hub and Node for Selenium Grid
i am trying to run my tests in a virtual machine. i have registered the hub and the node in the same machine....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In case anyone stumbles upon this issue, just use nssm instead of prunsrv. Way easier and more reliable.
helpful medium article on getting started with nssm: https://medium.com/@lk.snatch/jar-file-as-windows-service-bonus-jar-to-exe-1b7b179053e4
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.