Skip to content

Support for Selenium’s logging interface #284

Closed

Description

@graingert

The logging interface supported by Selenium FirefoxDriver isn’t available in Marionette.

I'd like support for the client.log('browser') call.

Activity

  1. jgraham commented on Oct 18, 2016

    @jgraham
    Member

    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.

  2. graingert commented on Oct 18, 2016

    @graingert
    Author

    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:

    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.

    —
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHub
    #284 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe-auth/AAZQTCR96Pk73MW0q3LzDrFlKXKIz25kks5q1JgEgaJpZM4KZliw
    .

  3. jgraham commented on Oct 18, 2016

    @jgraham
    Member

    On 18/10/16 11:24, Thomas Grainger wrote:

    Ah I see, is there any way to follow the development of the spec (mailing
    list github etc)?

    github.com/w3c/webdriver or the public-browser-tools-testing@w3.org
    mailing list.

  4. graingert commented on Oct 18, 2016

    @graingert
    Author
  5. graingert commented on Oct 18, 2016

    @graingert
    Author

    Here's the specific issue: w3c/webdriver#406

  6. 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
  7. shepmaster commented on Nov 27, 2017

    @shepmaster

    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.

  8. lucaspiller commented on Jan 12, 2018

    @lucaspiller

    @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.

  9. andreastt commented on Jan 12, 2018

    @andreastt
    Contributor

    @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

  10. whimboo commented on Apr 13, 2018

    @whimboo
    Collaborator

    Given that someone filed a bug for that, we now have https://bugzilla.mozilla.org/show_bug.cgi?id=1453962.

  11. yonjah commented on Jan 21, 2019

    @yonjah

    @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

  12. Herst commented on Jan 21, 2019

    @Herst

    @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.

  13. 15 remaining items

  14. hathiphant commented on Nov 6, 2020

    @hathiphant

    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.

  15. whimboo commented on Nov 13, 2020

    @whimboo
    Collaborator

    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.

  16. PhilippSelenium commented on Oct 21, 2021

    @PhilippSelenium

    @whimboo Should it already work with selenium 4.0 and geckodriver 30.0?

  17. whimboo commented on Nov 8, 2021

    @whimboo
    Collaborator

    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!

  18. PhilippSelenium commented on Nov 8, 2021

    @PhilippSelenium

    @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")?

  19. whimboo commented on Nov 8, 2021

    @whimboo
    Collaborator

    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:

    1. Start a WebDriver session via geckodriver with webSocketURL set to true.
    2. Retrieve the server address for WebDriver BiDi via the webSocketURL capability.
    3. Use a WebSocket client to connect to that address.
    4. Subscribe for log.entryAdded events.
    5. 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.

    To give you an impression here is some code from the web-platform-tests repository with a basic test for log.entryAdded that checks console messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址