If you check the comments in chrome.js, you will find a method to enable logging for chromewebdriver.
*
* By default, each Chrome session uses a single driver service, which starts
* when a {@link Driver} instance is created and stops when the process ends. The default service inherits its environment from the current process and sends all output to /dev/null. Access this default service using
* {@link #getDefaultService getDefaultService()} and modify it using {@link #setDefaultService setDefaultService()}.
*
* You can also create a {@link Driver} with its own driver service, useful for capturing server log output for a specific session:
*
* let chrome = require('selenium-webdriver/chrome');
*
* let service = new chrome.ServiceBuilder()
* .loggingTo('/my/log/file.txt')
* .enableVerboseLogging()
* .build();
*
* let options = new chrome.Options();
* // configure browser options ...
*
* let driver = chrome.Driver.createSession(options, service);
*
Another option available:
- Run ChromeDriver as a standalone process
Since ChromeDriver follows the wire protocol, it works seamlessly with any RemoteWebDriver client. Launch the ChromeDriver executable (as a server) with arguments --log-path
and --verbose
, create a client, and you're good to go:
WebDriver driver = new RemoteWebDriver(
"http://localhost:9515",
DesiredCapabilities.chrome()
);
driver.get("http://www.google.com");