Open Bug 1339614 Opened 3 years ago Updated Last year

Add ability to get browser logs via Marionette

Categories

(Testing :: Marionette, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: wlach, Unassigned)

References

(Blocks 1 open bug)

Details

There are lots of cases where getting the browser logs would be handy when using marionette. For the typical case where you're using it as the backend for selenium tests, the browser log can often give a very clear hint on how and why a test failed (syntax error, etc.).

This is supported in Chrome via chromedriver (http://stackoverflow.com/a/20910684), it would be nice to have the appropriate backend support in marionette so we could do the same via marionette and geckodriver.

I imagine this shouldn't be terribly difficult to do via some kind of chrome script?
A quick brain dump:

Technically not hard, but there would be a distinct advantage to have interoperability between implementations for such an API.  What logs do we want?  Granularities?  Data format?  Since WebDriver unfortunately only offers a polling API, what sort of memory limitations do we put on the server?

I think the answer to most of these questions give themselves, but it would be great to have a solid understanding of the use case before making a proposal.

I wrote the first implementation of log fetching from WebDriver in 2009 for OperaDriver, which allowed retrieval of the console- and network logs which at the time were pretty basic.  The driver would collect up to a certain number of log entries and pop older entries off the stack, then clear the cache when they were requested by a client.

We discussed it loosely at the F2F in Cambridge, MA three years ago, for which the minutes can be found at https://sny.no/bttmin.  I remember we talked about the possibility of also gathering logs from intermediary nodes and local ends.
Looking back at some earlier code, Opera offered a number of different log types that were specific to the browser: https://github.com/operasoftware/operaprestodriver/blob/master/src/com/opera/core/systems/OperaLogType.java

I wonder if available log types in Gecko, Blink, Safari, and Edge roughly cover the same topics?  Perhaps the API should allow arbitrary log types to be retrieved depending on the browser?
 
> I wonder if available log types in Gecko, Blink, Safari, and Edge roughly
> cover the same topics?  Perhaps the API should allow arbitrary log types to
> be retrieved depending on the browser?

Yes, one of those is going to be performance timeline, see Bug 1250290.
quick dump of how this should roughly work.

This needs to be turned on with a capability. e.g. https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities#loggingpreferences-json-object. the default is to not log.

How the packet is shaped can be found at https://github.com/seleniumhq/selenium/wiki/jsonwireprotocol#log-entry-json-object

When a user calls the end point for logs, we need to empty the buffer for the specific log type each time.
Priority: -- → P3
Blocks: 1439370
We discussed logging again at the F2F in Burlingame last year [1],
and the latest proposal is very different from how it used to be
implemented in Selenium.  To my knowledge there isn’t a proposal
drawn up for a logging API in WebDriver yet.

  [1] https://www.w3.org/2017/11/10-webdriver-minutes.html#item01
You need to log in before you can comment on or make changes to this bug.