I have been trying to figure out how to disable the annoying console logs when we run phantomjs(ghost driver) with webdriverjs but in vain.
[INFO - 2016-10-09T14:57:15.039Z] GhostDriver - Main - running on port 62381
[INFO - 2016-10-09T14:57:15.084Z] Session [aa75cc80-8e30-11e6-8da5-a561819d4151] - page.settings - {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1","webSecurityEnabled":true}
[INFO - 2016-10-09T14:57:15.084Z] Session [aa75cc80-8e30-11e6-8da5-a561819d4151] - page.customHeaders: - {}
[INFO - 2016-10-09T14:57:15.084Z] Session [aa75cc80-8e30-11e6-8da5-a561819d4151] - Session.negotiatedCapabilities - {"browserName":"phantomjs","version":"2.1.1","driverName":"ghostdriver","driverVersion":"1.2.0","platform":"mac-10.10 (Yosemite)-64bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}}
[INFO - 2016-10-09T14:57:15.084Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: aa75cc80-8e30-11e6-8da5-a561819d4151
Following is my configuration:
var webdriver = require('selenium-webdriver');
var phantomjs_exe = require('phantomjs-prebuilt').path;
var customPhantom = webdriver.Capabilities.phantomjs();
customPhantom.set("phantomjs.binary.path", phantomjs_exe);
//build custom phantomJS driver
var driver = new webdriver.Builder().
withCapabilities(customPhantom).
build();
Things done from my side -
Went through various SO threads but all of them had solutions/methods in java api bindings.I am looking for nodejs solutions. following are the things suggested :
Logger.getLogger(PhantomJSDriverService.class.getName()).setLevel(Level.OFF)
Silence ghostdriver.log
import os driver = webdriver.PhantomJS(service_log_path=os.path.devnull);
Using Desired Capabilities:
DesiredCapabilities dcap = new DesiredCapabilities(); String[] phantomArgs = new String[] {"--webdriver-loglevel=NONE"}; dcap.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, phantomArgs); PhantomJSDriver phantomDriver = new PhantomJSDriver(dcap);
How can I do them in nodejs webdriver api bindings?? can anyone guide in the right direction? I find very few api doc examples which are not useful!