Is it possible to obtain the logger somehow that Selenium WebDriver uses? I want to capture a transcript of all the commands that were issued (eg: open, wait, click, etc). In particular I am looking for a java solution, as I am exporting the tests into junit.
I found this code on their website, however it displays nothing on standard out
DesiredCapabilities caps = DesiredCapabilities.firefox();
LoggingPreferences logs = new LoggingPreferences();
logs.enable(LogType.DRIVER, Level.FINEST);
caps.setCapability(CapabilityType.LOGGING_PREFS, logs);
driver = new FirefoxDriver(caps);
Try
You will get Logs interface that has methods to get logs and log types. See Logs interface docs
Enable logging in the driver you're using, select which log types you're interested in and the log level (I'm using FirefoxDriver, enabling all types of logs and collecting all log messages)
Then, after running the test you can collect the logs (I'm only collecting the DRIVER logs, but you can do the same for any type of log)
I'm using log4j for logging as utils logger is the most easiest and straight forward one that, that can be used (IMHO).
POM dependencies:
imports are following:
usage:
and then just use it as such:
Hope this works for you.
Try this -
Reference - Selenium unit tests in Python -- where is my log file?