Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
968 views
in Technique[技术] by (71.8m points)

r - RSelenium rsDriver gives error can't kill an exited process

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...