Java PhantomJSDriver disable all logs in console

Alexey Kulikov picture Alexey Kulikov · Nov 24, 2013 · Viewed 11.7k times · Source

I'm developing a small console app using Selenium and I need to turn off all logs from it.

I have tried phantomJSDriver.setLogLevel(Level.OFF); but it does not work. I need help.

How do I disable all logs in console application that is using Selenium and Phantomjs (GhostDriver)?

Answer

Hery picture Hery · May 9, 2014

This one works for me.

DesiredCapabilities dcap = new DesiredCapabilities();
String[] phantomArgs = new  String[] {
    "--webdriver-loglevel=NONE"
};
dcap.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, phantomArgs);
PhantomJSDriver phantomDriver = new PhantomJSDriver(dcap);