Webdriverexception: Message: Invalid Argument: Can't Kill an Exited Process with Geckodriver, Selenium and Python on Raspberrypi3

WebDriverException: Message: invalid argument: can't kill an exited process with GeckoDriver, Selenium and Python on RaspberryPi3

Thumb rule

A common cause for Browsers to crash during startup is running WebDriver initiated Browsers as root user (administrator) on Linux. While it is possible to work around this issue by passing --no-sandbox flag when creating your WebDriver session, such a configuration is unsupported and highly discouraged. You need to configure your environment to run Browser as a regular user instead.


This error message...

selenium.common.exceptions.WebDriverException: Message: invalid argument: can't kill an exited process

...implies that the GeckoDriver was unable to initiate/spawn a new WebBrowsing Session i.e. Firefox Browser session.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • Your GeckoDriver version is 0.22.0.

  • Release Notes of GeckoDriver v0.21.0 (2018-06-15) clearly mentions the following:


  • Firefox 57 (and greater)


  • Selenium 3.11 (and greater)

  • Your Firefox version is 52.9.0.

So there is a clear mismatch between GeckoDriver v0.22.0 and the Firefox Browser v57



Solution

  • Upgrade GeckoDriver to GeckoDriver v0.22.0 level.
  • GeckoDriver is present in the specified location.
  • GeckoDriver is having executable permission for non-root users.
  • Upgrade Firefox version to Firefox v62.0.2 levels.
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • 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.
  • Execute your Selenium Test as a non-root user.


GeckoDriver, Selenium and Firefox Browser compatibility chart

geckodriver_versions

Invalid argument: can't kill an exited process, running Selenium in Python with geckodriver

Since I could run the script from the terminal, I eventually realized the he problem was gunicorn. I had to add
Environment="PATH=/usr/bin"
to the gunicorn service script running on the server.

RSelenium rsDriver gives error can't kill an exited process

You need to stick to your exact requirements regarding Selenium, GeckoDriver and Firefox versions which would be used in your test framework and remove the unwanted versions of binaries totally. GeckoDriver v0.24.0 being the latest release must be the chosen one.

Selenium v4.0.0-alpha-1 and Selenium v4.0.0-alpha-2 are alpha releases and must be avoided for Production usage. So Selenium v3.141.59 being the latest release must be the chosen one.

For GeckoDriver, Selenium and Firefox Browser compatibility you can find a detailed discussion in Which Firefox browser versions supported for given Geckodriver version?

Note: You don't need to install the GeckoDriver binary but put the binary in the desired location.

So an ideal usage would be:

rD <- rsDriver(browser = "firefox",
version = "3.141.59",
geckover = "0.24.0",
extraCapabilities = list(
"moz:firefoxOptions" = list(
binary = "/usr/lib64/firefox/firefox",
args = list('--headless')
)
))

If you are still facing the issue follow the below mentioned steps.


This error message...

message:invalid argument: can't kill an exited process

...can surface for different reasons. The possible solution can be any/either of the following:

  • Ensure that GeckoDriver v0.24.0 is downloaded and placed within the directory that is already in your path, e.g. /usr/local/bin
  • Ensure that GeckoDriver is having executable permission for non-root users.
  • Ensure that firefox (> v57.0) is installed (mandatory) within /usr/lib64/firefox/ directory as per your code block and the version is compatable.
  • Ensure that if you are running Firefox on a system with no display you have to use headless mode.
  • The correct usage of headless mode with GeckoDriver v0.24.0 is:

    options.headless = True
  • There is no need for xvfb-run anymore if you set MOZ_HEADLESS=1 as follows:

    $ export MOZ_HEADLESS=1   # this way you only have to set it once
  • If you have changed your system path, take a System Reboot.

  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
  • Always execute your @Tests as a non-root user.

References

You can find a relevant detailed discussions in:

  • WebDriverException: Message: invalid argument: can't kill an exited process with GeckoDriver, Selenium and Python on RaspberryPi3

WebDriverException: Message: invalid argument: can't kill an exited process with GeckoDriver, Selenium and Python on RaspberryPi3

Thumb rule

A common cause for Browsers to crash during startup is running WebDriver initiated Browsers as root user (administrator) on Linux. While it is possible to work around this issue by passing --no-sandbox flag when creating your WebDriver session, such a configuration is unsupported and highly discouraged. You need to configure your environment to run Browser as a regular user instead.


This error message...

selenium.common.exceptions.WebDriverException: Message: invalid argument: can't kill an exited process

...implies that the GeckoDriver was unable to initiate/spawn a new WebBrowsing Session i.e. Firefox Browser session.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • Your GeckoDriver version is 0.22.0.

  • Release Notes of GeckoDriver v0.21.0 (2018-06-15) clearly mentions the following:


  • Firefox 57 (and greater)


  • Selenium 3.11 (and greater)

  • Your Firefox version is 52.9.0.

So there is a clear mismatch between GeckoDriver v0.22.0 and the Firefox Browser v57



Solution

  • Upgrade GeckoDriver to GeckoDriver v0.22.0 level.
  • GeckoDriver is present in the specified location.
  • GeckoDriver is having executable permission for non-root users.
  • Upgrade Firefox version to Firefox v62.0.2 levels.
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • 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.
  • Execute your Selenium Test as a non-root user.


GeckoDriver, Selenium and Firefox Browser compatibility chart

geckodriver_versions



Related Topics



Leave a reply



Submit