问题
I was trying to launch Firefox browser through selenium, but unfortunately browser is getting closed immediately after it launches. I couldn't interpret from the log file.
Here are the log file entries:
1582121786461 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.d4XupquDfaWC"
1582121787117 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
1582121787117 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: telemetry
1582121787118 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
1582121787118 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: about:reader*
JavaScript error: resource:///modules/sessionstore/SessionStore.jsm, line 1325: uncaught exception: 2147746065
1582121789421 Marionette INFO Listening on port 33105
1582121789488 Marionette WARN TLS certificate errors will be ignored for this session
19:46:29.537 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
19:46:29.559 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session 1420379c-5cc3-444a-8309-0492333a3c5f (org.openqa.selenium.firefox.GeckoDriverService)
1582121794637 Marionette WARN TimedPromise timed out after 5000 ms: stacktrace:
bail@chrome://marionette/content/sync.js:237:64
Fatal: no entropy gathering module detected
Redirecting call to abort() to mozalloc_abort
###!!! [Parent][MessageChannel] Error: (msgtype=0x1E008F,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv
A content process crashed and MOZ_CRASHREPORTER_SHUTDOWN is set, shutting down
JavaScript error: resource:///modules/sessionstore/SessionFile.jsm, line 376: Error: _initWorker called too early! Please read the session file from disk first.
[Parent 423702, Gecko_IOThread] WARNING: pipe error (82): Connection reset by peer: file /home/abuild/rpmbuild/BUILD/firefox-68.2.0/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 358
1582121795636 Marionette INFO Stopped listening on port 33105
Here are the versions of Browser/libraries:
- Firefox version: 68.2.0esr
- Geckodriver version: 0.24
- Selenium version: 3.141.59
I have tried with different versions of Gecko driver and Selenium, but nothing worked. Please let me know any solution for this.
回答1:
This error message...
Fatal: no entropy gathering module detected
Redirecting call to abort() to mozalloc_abort
.
A content process crashed and MOZ_CRASHREPORTER_SHUTDOWN is set, shutting down
JavaScript error: resource:///modules/sessionstore/SessionFile.jsm, line 376:
Error: _initWorker called too early! Please read the session file from disk first.
[Parent 423702, Gecko_IOThread] WARNING: pipe error (82): Connection reset by peer: file /home/abuild/rpmbuild/BUILD/firefox-68.2.0/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
...implies that a content process crashed while creating the session and there was a kernel panic.
Deep dive
A bit of more information with respect to your code trials and Trace level logs would have helped us to analyze the issue in a better way. However, this issue was earlier observed with 4.9.x kernels. At times this issue was also observed with corrupted urandom / random
However, it seems your main issue is the incompatibility between the version of the binaries you are using as follows:
- You are using GeckoDriver v0.24.0 of Jan 29, 2019, which is more then a year older.
- You are using Firefox v68.2.0esr.
- Your JDK version is unknown to us.
As per the documentation in Supported platforms there seems to be some mismatch among the binaries as Firefoxen section mentions:
Support is best in Firefox 57 and greater, although generally the more recent the Firefox version, the better the experience as they have more bug fixes and features. Some features will only be available in the most recent Firefox versions, and we strongly advise using the latest Firefox Nightly with geckodriver. Since Windows XP support in Firefox was dropped with Firefox 53, we do not support this platform.
Note: Starting with the 0.26.0 release geckodriver is able to connect to Android devices, and to control packages which are based on GeckoView (eg. Firefox Preview aka Fenix, or Firefox Reality). But it also still supports versions of Fennec up to 68 ESR, which is the last officially supported release from Mozilla.
Solution
Ensure that:
- JDK is upgraded to current levels JDK 8u341.
- Selenium is upgraded to current levels Version 3.141.59.
- GeckoDriver is upgraded to GeckoDriver v0.26.0 level.
- Firefox is upgraded to current Firefox v72.0 levels.
- GeckoDriver is present in the desired location.
- GeckoDriver is having executable permission for non-root users.
- If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
- Take a System Reboot.
- Execute your
Test
as a non-root user. - Always invoke
driver.quit()
withintearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.
Outro
As per best practices while working with GeckoDriver, Selenium and Firefox Browser follow the below compatibility chart:
Supported platforms
来源:https://stackoverflow.com/questions/60319045/mozilla-firefox-68-2-0esr-browser-is-crashing-using-geckodriver-and-selenium