Home > Mobile >  selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 1 ru
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 1 ru

Time:03-31

I am running the following code:

from selenium import webdriver

driver = webdriver.Firefox()  
driver.get("https://web.whatsapp.com/")

I have installed firefox under /usr/bin/firefox and geckodriver (same version) under /usr/bin/geckodriver

However, I am getting the following stacktrace error when the Python code is run:

selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 1

Full code is here: https://github.com/harshitsidhwa/WhatsApp-bot-selenium/blob/master/whatsapp.py

CodePudding user response:

This error message...

selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 1

...implies that the GeckoDriver was unable to initiate/spawn a new Browsing Context i.e. session.

Possibly there are some incompatibility between the version of the binaries you are using.


Solution

Ensure that:

  • JDK is upgraded to current levels JDK 8u311.
  • Selenium is upgraded to current levels Version 4.1.3.
  • GeckoDriver is upgraded to GeckoDriver v0.30.0 level.
  • Firefox is upgraded to current Firefox v98.0.2 levels.
  • GeckoDriver is present in the desired location.
  • GeckoDriver is having executable permission for non-root users.

CodePudding user response:

I have the same error message when I running Selenium 4 Firefox on Centos 8

I check the log file geckodriver.log

It is showing

Running Firefox as root in a regular user's session is not supported.

so I'm using a non-root user to run the same Python script, It is working now.

  • Related