RSelenium rsDriver gives error can't kill an exited process

*爱你&永不变心* 提交于 2020-01-15 11:21:52

问题


I am struggling to make RSelenium work on a unix server. It has Mozilla Firefox 60.6.1, and running the two commands:

binman::list_versions("geckodriver")
$linux64
[1] "0.22.0" "0.23.0" "0.24.0"

binman::list_versions("seleniumserver")
$generic
[1] "3.141.59"      "4.0.0-alpha-1" "4.0.0-alpha-2"

it seems that the geckodriver is available (is it ?). But when I try to launch a driver :

> library(RSelenium)
> rD <- rsDriver(browser = "firefox",
+          extraCapabilities = list(
+            "moz:firefoxOptions" = list(
+              binary = "/usr/lib64/firefox/firefox",
+              args = list('--headless')
+            )
+          ))
...
[1] "Connecting to remote server"

Selenium message:invalid argument: can't kill an exited process
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'login2.cluster', ip: '192.168.100.12', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-957.5.1.el7.x86_64', java.version: '1.8.0_181'
Driver info: driver.version: unknown
remote stacktrace:

Could not open firefox browser.
Client error message:
         Summary: UnknownError
         Detail: An unknown server-side error occurred while processing the command.
         Further Details: run errorDetails method
Check server log for further details.

From this question and others I tried to downgrade the version of geckodriver, and make use of the headless mode of firefox:

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

But still get the same error. My suspicion would be that geckodriver is actually not installed. Is this possible ? How to check it ?

Thank you for your help


回答1:


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


来源:https://stackoverflow.com/questions/57506107/rselenium-rsdriver-gives-error-cant-kill-an-exited-process

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!