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
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:
/usr/local/bin
/usr/lib64/firefox/
directory as per your code block and the version is compatable.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.
driver.quit()
within tearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.You can find a relevant detailed discussions in: