Reputation: 303
I've been using Selenium for 2 weeks.
It's been really useful so far.
When developing, I like having the browsers pop up so I can see what's going on, but in production, I don't want the server to keep opening and closing Firefox windows. I've looked through this forum, done Google searches, etc., but can't find a way to run the browsers in the background.
Anybody have a tip on how to do this?
Upvotes: 3
Views: 16088
Reputation: 159
Found simple solutin for JAVA Seleniun Google Chrome
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("headless");
return new ChromeDriver(options);
Upvotes: 6
Reputation: 31
Phantom is good headless option, but sssuming you want to stick with same tools you are using ... (the following assumes Linux as platform)
DISPLAY=:1 xvfb-run java -jar [selenium JAR filename]
Now, when your test suite kicks off selenium, it will run using Firefox without browser windows popping up.
Upvotes: 1
Reputation: 458
Have you thought about running against a Selenium Grid instead? See https://code.google.com/p/selenium/wiki/Grid2
Upvotes: 0
Reputation: 21129
Try PhantomJS which is a headless browser webkit. HTMLUnit is also similar to PhantomJs; however, usage of PhamtomJs is highly recommended.
PhantomJs uses Google chrome's JavaScript Engine
but without a GUI.
Refer :http://phantomjs.org/
Upvotes: 3
Reputation: 6131
if the server is on linux, you can allocate a display just to run selenium using Xvfb to create a virtual display
if the server is on windows you can register the daemon to run as another user than the user logged in, giving the service a desktop. this only work for the local system admin account or by registry tweaking as detailed here note that you will have to set up internet explorer properties for the user the service is running as
Upvotes: 2
Reputation: 3129
Give it a try : https://github.com/detro/ghostdriver.
It uses Headless approach to automate websites.
Upvotes: 1