By default ChromeDriver logs only warnings/errors to stderr. When debugging issues, it is helpful to enable more verbose logging.
To enable verbose logging, simply pass --verbose
to the chromedriver server.
You can also pass --log-path
to cause the log to be written to a file instead
of stderr. If you don't start the chromedriver server directly yourself, you
need to pass the switch via your WebDriver client library. Some clients do not
have an option for this yet unfortunately.
When passing --log-path
to Chrome launch command, the stderr on Chrome Linux
and Mac will be saved in the log file. However, the stderr on Windows is not
saved because Chrome is a GUI application and the OS doesn't allow it to inherit
stderr handle from ChromeDriver. To save stderr on Windows, Linux and Mac, you
can use the CHROME_LOG_FILE
environment variable and the file would only
contain logs from Chrome. If you specify logPath in ChromeOptions, ChromeDriver
would copy its value to CHROME_LOG_FILE
.
Neither stderr nor stdout is captured on Android. The stdout goes to the console window on all platforms.
C#
var service = ChromeDriverService.CreateDefaultService();
service.LogPath = "D:\\chromedriver.log";
service.EnableVerboseLogging = true;
driver = new ChromeDriver(service);
There are overloaded version of both functions, see the API documentation.
Java
System.setProperty("webdriver.chrome.logfile", "D:\\chromedriver.log");
System.setProperty("webdriver.chrome.verboseLogging", "true");
Python
driver = webdriver.Chrome(executable_path="D:\\chromedriver.exe", service_args=["--verbose", "--log-path=D:\\qc1.log"])
All languages
Start chromedriver in the command prompt/terminal with verbose logging using the flags:
--verbose --log-path=chromedriver.log
Run your test using a RemoteWebDriver pointed at http://localhost:9515.