Skip to content

Capture browser console.log #412

Closed
Closed

Description

@datakurre

Is it possible to capture console.log messages with Selenium and expose that to selenium2library? Dumping captured console.log would also be great addition to onError behavior.

Activity

  1. datakurre commented on May 31, 2015

    @datakurre
    Author

    Selenium Wiki mentions plans for this and inclusion in "Wire" protocol. Woul you know, are those already implemented and usable through selenium library?

    https://code.google.com/p/selenium/wiki/Logging
    https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/log

  2. datakurre commented on May 31, 2015

    @datakurre
    Author

    In addition, gettin JS stacktrace would be nice, if it's possible.

  3. datakurre commented on May 31, 2015

    @datakurre
    Author

    It seems that Selenium Logging is implemented at least in Firefox WebDriver. It provides log types 'browser' and 'driver'. Yet, that command is not configured in python selenium bindings yet, but it must be manually configured.

    def log_console(self):
        browser = self._current_browser()
        browser.command_executor._commands['log'] = (
            'POST', '/session/$sessionId/log'
        )
        return browser.execute('log', params={'type': 'browser'})['value']
    

    Unfortunately, it seems that at least for FX this returns only 'Browser console' messages. Because it won't return messages from 'Web console' it's not very useful for debugging JS apps.

  4. just-be-dev commented on May 31, 2015

    @just-be-dev
    Contributor

    I've done some investigation into this myself, but I haven't figured anything out yet. I'll let you know if I come up with something.

  5. aaltat commented on Aug 20, 2017

    @aaltat
    Contributor

    I think this is now implemented by #863. If you disagree, please send an update.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions