You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
changed the title [-]The log interface implemented by FirefoxDriver and Selenium isn’t supported in Marionette.[/-][+]Support for Selenium’s logging interface[/+]on Oct 18, 2016
I don't suppose that there is some temporary alternative we can use? Verifying that there are no JS errors in our automated tests is a very nice feature.
Reacted by Luca, Conor Schaefer, Sebastian Mobo, Steve Hull, Shaoyi Zhang, mtman, Tau Gärtli, Jonathan--V, Thomas Lee and PhilippSelenium
@shepmaster I've been looking at this today, as we also want to verify that no JS errors are thrown.
My solution probably won't go down too favourably in this repo, but it does the trick: Switch to using Chrome for integration tests, as chromedriver supports that standard Selenium browser logging interface.
Reacted by PhilippSelenium, Robert Castles and kenzadekik365
@lucaspiller Chrome uses a standards incompatible version of the logging interface and we have no intention of implementing that.
A brief update on this is that we discussed logging at the last WebDriver working group meeting and I wrote down some quick words here: https://sny.no/2017/12/wdupdate
@andreastt any news on this one ?
If I understand it correctly the recommendation currently by w3c team is to use the chromedriver w3c/webdriver#710 (comment) . It doesn't look like this has any priority to be entered into the standard w3c/webdriver#406
I was really hopping to have firefox as my main target for automated testing but not having logs means its not going to be practical
@yonjah If I understand it correctly the WebDriver clients themselves use more powerful protocols to communicate with the applications. In the case of ChromeDriver it's CDP and in the case of Firefox it's Marionette, so while a certain feature might not be part of WebDriver it might still be part of the browser-specific control protocol and you can make use it of it in this way.
Just for simplicity, isn't it possible to do something simple on HTTP with Server-Sent Events endpoints, without adding the complexity of a BiDi protocol on WebSocket.
When you open a window with WebDriver, you configure optionally log type/level and you obtain in response the URL on geckodriver of an SSE endpoint with events of navigation. This is the only SSE endpoint living as long as window and keeping only history of navigation (like a browser). In the events of navigation, the message contains the URL of each new location in the window and also the URL of an SSE endpoint sending the log events occurring for this page but without warranty to be available more than the time where the page is currently loaded in the window (this does not need more cache of events than devtools currently use when launched on a page).
GET http://127.0.0.1:4444/logs/$pagelog_endpoint
This SSE endpoint is only available when the driven window is on the corresponding page; after that, geckodriver is free to forget logs and to respond HTTP 410 Gone or 404. It sends SSE events of logs, like:
Note that with Selenium 4 there will be support for CDP (Chrome DevTools Protocol). I'm currently working on making geckodriver to offer an opt-in for a websocket URL that can be used with our own implementation of a subset of the CDP APIs (called Remote Protocol. We already have a good amount of APIs (commands and events) implemented, and we want to see that especially the logging events will work. That means it can be used until the WebDriver Bidi support is available by sometime next year.
Selenium 4.0.0 makes use of the CDP implementation for both Firefox and Chrome. Note that this a temporary solution to allow users to subscribe to log events. Currently we are working on WebDriver BiDi support for log.entryAdded which should be fully available by at latest end of this year.
The Selenium implementation has been built to cause a minimal impact on consumers when the move from CDP to BiDi will happen. So yes, you should be able to get started but note that our CDP implementation for log events is not complete, and won't ever be compared to the WebDriver BiDi standard implementation.
Given that geckodriver will not be used for WebDriver BiDi but Firefox itself will contain the full implementation I do not see a need to further track this issue. As such I'm going to close it now.
I hope you all will enjoy the soon upcoming feature!
Right, geckodriver is only used for WebDriver HTTP, and as helper to opt-in to WebDriver BiDi via the webSocketUrl capability. Everything else will be directly implemented in Firefox itself, and communication will happen via its own WebSocket connection.
I cannot speak about the Selenium side given that this is its own project. But what you want is:
Start a WebDriver session via geckodriver with webSocketURL set to true.
Retrieve the server address for WebDriver BiDi via the webSocketURL capability.
Use a WebSocket client to connect to that address.
Subscribe for log.entryAdded events.
Handle log.entryAdded events in your code
Note that there is still the hen and egg problem with not having a proper BiDi client available yet. But AFAIK Selenium folks want to integrate the BiDi feature probably in the 4.1 release.
Activity
jgraham commentedon Oct 18, 2016
This isn't in the W3C spec at this time, so we are delaying support until the behaviour is well specified. But your request is noted.
graingert commentedon Oct 18, 2016
Ah I see, is there any way to follow the development of the spec (mailing
list github etc)?
On 18 Oct 2016 10:57, "jgraham" notifications@github.com wrote:
jgraham commentedon Oct 18, 2016
On 18/10/16 11:24, Thomas Grainger wrote:
github.com/w3c/webdriver or the public-browser-tools-testing@w3.org
mailing list.
graingert commentedon Oct 18, 2016
Linkifying for other users: https://github.com/w3c/webdriver public-browser-tools-testing@w3.org
graingert commentedon Oct 18, 2016
Here's the specific issue: w3c/webdriver#406
[-]The log interface implemented by FirefoxDriver and Selenium isn’t supported in Marionette.[/-][+]Support for Selenium’s logging interface[/+]shepmaster commentedon Nov 27, 2017
I don't suppose that there is some temporary alternative we can use? Verifying that there are no JS errors in our automated tests is a very nice feature.
lucaspiller commentedon Jan 12, 2018
@shepmaster I've been looking at this today, as we also want to verify that no JS errors are thrown.
My solution probably won't go down too favourably in this repo, but it does the trick: Switch to using Chrome for integration tests, as chromedriver supports that standard Selenium browser logging interface.
andreastt commentedon Jan 12, 2018
@lucaspiller Chrome uses a standards incompatible version of the logging interface and we have no intention of implementing that.
A brief update on this is that we discussed logging at the last WebDriver working group meeting and I wrote down some quick words here: https://sny.no/2017/12/wdupdate
whimboo commentedon Apr 13, 2018
Given that someone filed a bug for that, we now have https://bugzilla.mozilla.org/show_bug.cgi?id=1453962.
logs only js errors, not console log due to firefox issue mozilla/gec…
yonjah commentedon Jan 21, 2019
@andreastt any news on this one ?
If I understand it correctly the recommendation currently by w3c team is to use the chromedriver w3c/webdriver#710 (comment) . It doesn't look like this has any priority to be entered into the standard w3c/webdriver#406
I was really hopping to have firefox as my main target for automated testing but not having logs means its not going to be practical
Herst commentedon Jan 21, 2019
@yonjah If I understand it correctly the WebDriver clients themselves use more powerful protocols to communicate with the applications. In the case of ChromeDriver it's CDP and in the case of Firefox it's Marionette, so while a certain feature might not be part of WebDriver it might still be part of the browser-specific control protocol and you can make use it of it in this way.
15 remaining items
Capture the logs from the Firefox console.
Capture the logs from the Firefox console.
Capture the logs from the Firefox console.
Capture the logs from the Firefox console. (#3058)
kurento-test: geckodriver (Firefox) cannot fetch console logs
kurento-test: geckodriver (Firefox) cannot fetch console logs
use method of redirecting browser console logs to geckodriver logs re…
hathiphant commentedon Nov 6, 2020
Just for simplicity, isn't it possible to do something simple on HTTP with Server-Sent Events endpoints, without adding the complexity of a BiDi protocol on WebSocket.
When you open a window with WebDriver, you configure optionally log type/level and you obtain in response the URL on geckodriver of an SSE endpoint with events of navigation. This is the only SSE endpoint living as long as window and keeping only history of navigation (like a browser). In the events of navigation, the message contains the URL of each new location in the window and also the URL of an SSE endpoint sending the log events occurring for this page but without warranty to be available more than the time where the page is currently loaded in the window (this does not need more cache of events than devtools currently use when launched on a page).
POST http://127.0.0.1:4444/session
{"capabilities", {"alwaysMatch": {"browserName", "firefox", "logs": {"javascript": "error", "css": "warning", "request": "trace"}}}}
responding with:
{"value": {"sessionId": "$sessionId", "navigation": "$navigation_endpoint"}}
GET http://127.0.0.1:4444/navigation/$navigation_endpoint
This SSE endpoint is only available when window is open and sends SSE events like:
event: location
data: {"url": "...", "logs": "$pagelog_endpoint"}
GET http://127.0.0.1:4444/logs/$pagelog_endpoint
This SSE endpoint is only available when the driven window is on the corresponding page; after that, geckodriver is free to forget logs and to respond HTTP 410 Gone or 404. It sends SSE events of logs, like:
event: request
data: {"level": "trace", "url": "..."}
event: css
data: {"level": "error", "url": "...", "line": ..., "column": ..., "message": "..."}
Just my opinion,
Thanks for reading.
whimboo commentedon Nov 13, 2020
Note that with Selenium 4 there will be support for CDP (Chrome DevTools Protocol). I'm currently working on making geckodriver to offer an opt-in for a websocket URL that can be used with our own implementation of a subset of the CDP APIs (called Remote Protocol. We already have a good amount of APIs (commands and events) implemented, and we want to see that especially the logging events will work. That means it can be used until the WebDriver Bidi support is available by sometime next year.
PhilippSelenium commentedon Oct 21, 2021
@whimboo Should it already work with selenium 4.0 and geckodriver 30.0?
whimboo commentedon Nov 8, 2021
Selenium 4.0.0 makes use of the CDP implementation for both Firefox and Chrome. Note that this a temporary solution to allow users to subscribe to log events. Currently we are working on WebDriver BiDi support for
log.entryAddedwhich should be fully available by at latest end of this year.The Selenium implementation has been built to cause a minimal impact on consumers when the move from CDP to BiDi will happen. So yes, you should be able to get started but note that our CDP implementation for log events is not complete, and won't ever be compared to the WebDriver BiDi standard implementation.
Given that geckodriver will not be used for WebDriver BiDi but Firefox itself will contain the full implementation I do not see a need to further track this issue. As such I'm going to close it now.
I hope you all will enjoy the soon upcoming feature!
PhilippSelenium commentedon Nov 8, 2021
@whimboo Thanks, but this answer caused more confusion for me than it claryfied:
So CDP will not be (completely) supported but the BiDi will not be supported by geckodriver since it will be an inherent feature of firefox??
What has to happen on the selenium side (or any other side) to get the console log via
client.log("browser")?whimboo commentedon Nov 8, 2021
Right, geckodriver is only used for WebDriver HTTP, and as helper to opt-in to WebDriver BiDi via the
webSocketUrlcapability. Everything else will be directly implemented in Firefox itself, and communication will happen via its own WebSocket connection.I cannot speak about the Selenium side given that this is its own project. But what you want is:
webSocketURLset to true.webSocketURLcapability.log.entryAddedevents.log.entryAddedevents in your codeNote that there is still the hen and egg problem with not having a proper BiDi client available yet. But AFAIK Selenium folks want to integrate the BiDi feature probably in the 4.1 release.
To give you an impression here is some code from the web-platform-tests repository with a basic test for
log.entryAddedthat checks console messages.