Skip to content

[🐛 Bug]: [py] get_log() doesn't work with Firefox #15588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cgoldberg opened this issue Apr 7, 2025 · 8 comments · Fixed by #15641
Closed

[🐛 Bug]: [py] get_log() doesn't work with Firefox #15588

cgoldberg opened this issue Apr 7, 2025 · 8 comments · Fixed by #15641
Assignees
Labels
C-py Python Bindings D-firefox I-defect Something is not working as intended OS-linux R-help wanted Issues looking for contributions

Comments

@cgoldberg
Copy link
Contributor

cgoldberg commented Apr 7, 2025

Description

Calling the driver.get_log() method when using Firefox doesn't work and returns an error.

Reproducible Code

from selenium import webdriver

driver = webdriver.Firefox()
print(driver.get_log('browser'))

Debugging Logs

DEBUG:selenium.webdriver.common.selenium_manager:Selenium Manager binary found at: /home/cgoldberg617/code/selenium/py/selenium/webdriver/common/linux/selenium-manager
DEBUG:selenium.webdriver.common.selenium_manager:Executing process: /home/cgoldberg617/code/selenium/py/selenium/webdriver/common/linux/selenium-manager --browser firefox --debug --language-binding python --output json
DEBUG:selenium.webdriver.common.selenium_manager:geckodriver not found in PATH
DEBUG:selenium.webdriver.common.selenium_manager:firefox not found in PATH
DEBUG:selenium.webdriver.common.selenium_manager:firefox not found in the system
DEBUG:selenium.webdriver.common.selenium_manager:Required browser: firefox 137.0
DEBUG:selenium.webdriver.common.selenium_manager:firefox 137.0 already exists
DEBUG:selenium.webdriver.common.selenium_manager:firefox 137.0 is available at /home/cgoldberg617/.cache/selenium/firefox/linux64/137.0/firefox
DEBUG:selenium.webdriver.common.selenium_manager:Required driver: geckodriver 0.36.0
DEBUG:selenium.webdriver.common.selenium_manager:geckodriver 0.36.0 already in the cache
DEBUG:selenium.webdriver.common.selenium_manager:Driver path: /home/cgoldberg617/.cache/selenium/geckodriver/linux64/0.36.0/geckodriver
DEBUG:selenium.webdriver.common.selenium_manager:Browser path: /home/cgoldberg617/.cache/selenium/firefox/linux64/137.0/firefox
DEBUG:selenium.webdriver.common.service:Started executable: `/home/cgoldberg617/.cache/selenium/geckodriver/linux64/0.36.0/geckodriver` in a child process with pid: 14822 using 0 to output -3
DEBUG:selenium.webdriver.remote.remote_connection:POST http://localhost:60911/session {'capabilities': {'firstMatch': [{}], 'alwaysMatch': {'browserName': 'firefox', 'acceptInsecureCerts': True, 'moz:debuggerAddress': True, 'pageLoadStrategy': <PageLoadStrategy.normal: 'normal'>, 'browserVersion': None, 'moz:firefoxOptions': {'binary': '/home/cgoldberg617/.cache/selenium/firefox/linux64/137.0/firefox', 'prefs': {'remote.active-protocols': 3}}}}}
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): localhost:60911
DEBUG:urllib3.connectionpool:http://localhost:60911 "POST /session HTTP/1.1" 200 0
DEBUG:selenium.webdriver.remote.remote_connection:Remote response: status=200 | data={"value":{"sessionId":"96ed6e1f-9fe9-475e-8d46-5e5726273c6b","capabilities":{"acceptInsecureCerts":true,"browserName":"firefox","browserVersion":"137.0","moz:accessibilityChecks":false,"moz:buildID":"20250327043313","moz:debuggerAddress":"127.0.0.1:48015","moz:geckodriverVersion":"0.36.0","moz:headless":false,"moz:platformVersion":"6.6.67-06628-g571b599e617d","moz:processID":14825,"moz:profile":"/tmp/rust_mozprofile4fOCFz","moz:shutdownTimeout":60000,"moz:webdriverClick":true,"moz:windowless":false,"pageLoadStrategy":"normal","platformName":"linux","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:137.0) Gecko/20100101 Firefox/137.0"}}} | headers=HTTPHeaderDict({'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-cache', 'content-length': '814', 'date': 'Mon, 07 Apr 2025 17:11:33 GMT'})
DEBUG:selenium.webdriver.remote.remote_connection:Finished Request
DEBUG:selenium.webdriver.remote.remote_connection:POST http://localhost:60911/session/96ed6e1f-9fe9-475e-8d46-5e5726273c6b/se/log {'type': 'browser'}
DEBUG:urllib3.connectionpool:http://localhost:60911 "POST /session/96ed6e1f-9fe9-475e-8d46-5e5726273c6b/se/log HTTP/1.1" 405 0
DEBUG:selenium.webdriver.remote.remote_connection:Remote response: status=405 | data=HTTP method not allowed | headers=HTTPHeaderDict({'content-type': 'text/plain; charset=utf-8', 'content-length': '23', 'date': 'Mon, 07 Apr 2025 17:11:37 GMT'})
DEBUG:selenium.webdriver.remote.remote_connection:Finished Request
Traceback (most recent call last):
  File "/home/cgoldberg617/code/selenium/py/sel.py", line 21, in <module>
    print(driver.get_log('browser'))
          ~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/home/cgoldberg617/code/selenium/py/selenium/webdriver/remote/webdriver.py", line 1192, in get_log
    return self.execute(Command.GET_LOG, {"type": log_type})["value"]
           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cgoldberg617/code/selenium/py/selenium/webdriver/remote/webdriver.py", line 429, in execute
    self.error_handler.check_response(response)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/home/cgoldberg617/code/selenium/py/selenium/webdriver/remote/errorhandler.py", line 196, in check_response
    raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: HTTP method not allowed
@cgoldberg cgoldberg added A-needs-triaging A Selenium member will evaluate this soon! I-defect Something is not working as intended labels Apr 7, 2025
@selenium-ci
Copy link
Member

@cgoldberg, thank you for creating this issue. We will troubleshoot it as soon as we can.

Selenium Triage Team: remember to follow the Triage Guide

@titusfortner
Copy link
Member

Yeah, Selenium no longer has its own logging API; I think it's been removed in all the other bindings (e.g., 8747489)

The action here is to deprecate and/or remove the method and use the Chrome specific logging mechanism for dealing with Chrome logs

@titusfortner titusfortner added R-help wanted Issues looking for contributions and removed A-needs-triaging A Selenium member will evaluate this soon! labels Apr 16, 2025
@selenium-ci
Copy link
Member

This issue is looking for contributors.

Please comment below or reach out to us through our IRC/Slack/Matrix channels if you are interested.

@cgoldberg
Copy link
Contributor Author

I can work on this.

So do we want to remove all the commands that access the /session/$sessionId/se/log endpoint, and everything that accesses them? (Firefox doesn't even respond to that endpoint as described in this bug... Chrome does, but I don't know if it returns anything useful).

@cgoldberg cgoldberg self-assigned this Apr 18, 2025
@cgoldberg
Copy link
Contributor Author

And do I need to deprecate everything for future removal, or can I just remove it? I don't think it makes sense to deprecate it if it doesn't even currently work.

@cgoldberg
Copy link
Contributor Author

This removes it: #15641

@cortlepp
Copy link

cortlepp commented May 7, 2025

I don't know whether this was intended, but this change breaks accesses to the log of remote chromium browsers (see also the references on you PR after this change was released) @cgoldberg .

@cgoldberg
Copy link
Contributor Author

I'll take a look... Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-py Python Bindings D-firefox I-defect Something is not working as intended OS-linux R-help wanted Issues looking for contributions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants