Closed Bug 1453962 Opened 4 years ago Closed 4 years ago

Add support for Selenium’s logging interface


(Testing :: geckodriver, defect, P3)

56 Branch


(Not tracked)



(Reporter: stephen.staple, Unassigned)




(Whiteboard: [blocked by spec])

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

Steps to reproduce:

Windows 10 Pro for Workstations

Selenium Version:  
Firefox Quantum 59.0.2 (64-bit)

I am trying to capture errors using Java & Selenium, using this method:

Here I set up the log:


			global.variables.logs = new LoggingPreferences();
			global.variables.logs.enable(LogType.BROWSER, Level.SEVERE);
			DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox();
			desiredCapabilities.setCapability(CapabilityType.LOGGING_PREFS, global.variables.logs);
			System.setProperty("webdriver.gecko.driver", filename);
			FirefoxOptions options = new FirefoxOptions()
					.addPreference("browser.tabs.remote.autostart", false)
					.addPreference("security.sandbox.content.level", 5);

			driver = new FirefoxDriver(options);`

Here I try to print out any messages in those logs:


		System.out.println(thisClass + " Checking for log entries. ");

		try {
			LogEntries logEntries = driver.manage().logs().get(LogType.BROWSER);
			if (logEntries != null) {
				System.out.println(thisClass + " logEntries is not null. ");
				for (LogEntry logEntry : logEntries) {
					// Get log message, timestamp and level.
					debug.print(thisClass + " logEntry.getTimestamp : " + logEntry.getTimestamp());
					debug.print(thisClass + " logEntry.getMessage : " + logEntry.getMessage());
					debug.print(thisClass + " logEntry.getClass : " + logEntry.getClass());
					debug.print(thisClass + " logEntry.getLevel : " + logEntry.getLevel());
			}else {
				System.out.println(thisClass + " logEntries is null. ");

		} catch (Exception e) {
			int errorCode=1523626889;
			System.out.println(thisClass + " Could not generate device logs. ");
			System.err.println(thisClass + " errorCode: " + errorCode + " Exception: " + e.getMessage());

If this method is no longer available, how else might we capture errors from the browser?

Actual results:

When running it, I get an error:

> Exception: POST /session/5ff98e14-c578-461c-aae2-8dc7cb3ffbec/log did not match a known command
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'SSTAPLE', ip: '', 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 59.0.2, javascriptEnabled: true, moz:accessibilityChecks: false, moz:headless: false, moz:processID: 13892, moz:profile: C:\Users\SStaple\AppData\Lo..., moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: XP, platformName: XP, platformVersion: 10.0, rotatable: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}}
Session ID: 5ff98e14-c578-461c-aae2-8dc7cb3ffbec

Expected results:

Displays errors encountered (which I can otherwise see by clicking F12 in Firefox & viewing the Console log.)
Please see

This is not supported yet.
Ever confirmed: true
Summary: Detecting errors in the browser with Selenium → Add support for Selenium’s logging interface
Priority: -- → P3
Whiteboard: [blocked by spec]
Yes, I understand it is not supported yet. What I am asking is how else might we capture errors from the browser? See my question - above!
We will not be adding support for the Selenium log API. tracks defining a log
API in WebDriver, and I believe Simon Stewart had a proposal for
it at the F2F in Burlingame, but I can’t find it written down.  The
meeting minutes should be accessible though.
Closed: 4 years ago
Resolution: --- → WONTFIX
(In reply to Stephen from comment #2)
> Yes, I understand it is not supported yet. What I am asking is how else
> might we capture errors from the browser? See my question - above!

What kind of failures do you want to see exactly? Do you have an example? Basically all logging we currently have should go into the geckodriver.log. Best is to use it with the trace level:
You need to log in before you can comment on or make changes to this bug.