Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browsing context has been discarded using GeckoDriver Firefox through Selenium

I didn't make any changes to my python selenium program and it worked fine 3 days ago. Now when i try to use it i get:

Browsing context has been discarded Failed to decode response from marionette

Any idea what could have caused this outside the code? (since no changes were made)

I'm using firefox and geckodriver. After i got these errors i updated firefox, geckodriver, and selenium, but it didn't help.

like image 873
Tintinabulator Zea Avatar asked Oct 17 '22 07:10

Tintinabulator Zea


1 Answers

This error message...

Browsing context has been discarded
.
Failed to decode response from marionette

...implies that the communication between GeckoDriver and Marionette was broken.

Some more information regarding the binary version interms of:

  • Selenium Server/Client
  • GeckoDriver
  • Firefox

Additionally, your code block and the error stack trace would have given us some clues about whats wrong happening. However this issue can happen due to multiple factors as follows:

  • As per Hang when navigation request removes the current browsing context if you have used driver.navigate().back(); when Selenium's focus was within an <iframe> this error is observed.
  • As per Crash during command execution results in "Internal Server Error: Failed to decode response from marionette" this issue can also occur due to ctypes checks for NULL pointer derefs.
    • You can find the Selenium testcase here. Perhaps instead of panicking, it would have been better to handle this more gracefully by clearing any state and returning geckodriver to accept new connections again.
  • As per Failed to decode response from marionette - Error to open Webdriver using python this issue can also occur if you are not using the complient version of the binaries.

GeckoDriver, Selenium and Firefox Browser compatibility chart

GeckoDriverVersions


Reference

You can find a relevant detailed discussion in:

  • “Failed to decode response from marionette” message in Python/Firefox headless scraping script
like image 100
undetected Selenium Avatar answered Nov 12 '22 20:11

undetected Selenium