Starting selenium server from java in the background

1.4k views Asked by At

I want to make easy-to-use selenium tests - just run one file and it starts the server, connects to it, run the tests, then close the server and exit (on windows).

I don't want the user to see the selenium console so I want to hide it if possible (run it in background and maybe log output). How can I start selenium server directly from Java?

2

There are 2 answers

0
NickSoft On BEST ANSWER

Well, it wasn't that hard (at least on windows). I used to start selenium server like this:

java -jar selenium-server-xxx.jar <options>

To start it without console I just use javaw:

javaw -jar selenium-server-xxx.jar <options>
0
Sampath Kumar S On

Create a windows .bat file and run the .bat file to start the selenium server. You can also include your test classes and dependencies.

eg:

java -cp ".;.\supportlibraries\junit4.11.jar;.\supportlibraries\poi-3.8-20120326.jar;D:\downloads\Selenium 2.0\selenium-server-standalone-2.45.0.jar" org.junit.runner.JUnitCore [classname]