Rselenium driver error : driver.version: unknown, SessionNotCreatedException - r

It's been a week struggling with this. I've checked every version of chrome, chrome driver, geckodriver, Selenoum.jar, even R. I also replaced a number of rselenium folders in C drive.
Why R cannot sense the Chromedriver and returns SessionNotCreatedException error?
How can I solve this? I'm really desperate cause this is a part of my final assignment for uni,
and I cannot even start it.
I just want to go with Chrome, not switching to Mozila's Firefox.
OS : Windows 11
R version : 4.1.3
IDE : Rstudio
Chrome : 107.0.5304.107
geckodriver : geckodriver-v0.31.0-win64
chromedrvier : 107.0.5304.62
Selenium : selenium-server-standalone-4.0.0-alpha-1
JAVA : java version "17.0.4.1"
R code ↓
library(rvest)
library(dplyr)
library(httr)
library(RSelenium)
remDr = remoteDriver(
remoteServerAddr="localhost",
port=4445L,
browserName="chrome")
remDr$open()
R error message ↓
Selenium message:Unable to create new service: ChromeDriverService
Build info: version: '4.0.0-alpha-1', revision: 'd1d3728cae', time: '2019-04-24T16:15:24'
System info: host: 'JIMMMMM', ip: 'xxx.xxx.x.x', os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.4.1'
Driver info: driver.version: unknown
Error: Summary: SessionNotCreatedException
Detail: A new session could not be created.
Further Details: run errorDetails method
cmd code ↓
C:\Windows\System32>cd C:\r-selenium
C:\r-selenium>java -Dwebdriver.gecko.driver="geckodriver.exe" -jar selenium-server-standalone-4.0.0-alpha-1.jar -port 4445
15:50:22.250 INFO [GridLauncherV3.parse] - Selenium server version: 4.0.0-alpha-1, revision: d1d3728cae
15:50:22.384 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4445
15:50:22.816 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
15:50:23.195 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4445
15:50:35.377 INFO [ActiveSessionFactory.apply] - Capabilities are: {
"browserName": "chrome",
"javascriptEnabled": true,
"nativeEvents": true,
"version": ""
}
15:50:35.387 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
15:50:40.294 INFO [ActiveSessionFactory.apply] - Capabilities are: {
"browserName": "chrome",
"javascriptEnabled": true,
"nativeEvents": true,
"version": ""
}
15:50:40.297 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Checked versions of every programm needed.
Checked binman::list_versions("chromedriver") to match the versions of Chrome driver and Chrome.
Reinstalled rsellenium library, Geckodriver, Chromedriver, Selenium.

Problem solved. It was all about directories...
I set my working directory as C:\r-selenium, but chromedriver and gecko were C:\r-selenium\chromedriver_win32,
C:\r-selenium\geckodriver-v0.17.0-win64 for each.

Related

RStudio server RSelenium chrome server error (chrome not reachable) -- but works in SSH R terminal session

I am working with a remote server running Ubuntu 19.10. I'd like to initiate a non-headless chrome server and have developed the following script:
require(RSelenium)
eCaps <- list(chromeOptions = list(
args = c('--window-size=1280,800',
"--disable-extensions",
"--use-gl=swiftshader",
"--user-data-dir=/home/user/.config/google-chrome/Profile1",
"--remote-debugging-port=9222")
))
# Google Chrome version is 81.0.4044.138
rD <- rsDriver(browser = "chrome",
chromever = "81.0.4044.138",
extraCapabilities = eCaps,
port =
as.integer(base::sample(seq(32768,65535, by=1),1)))
remDr <- rD[["client"]]
remDr$navigate("https://stackoverflow.com/")
If I log into the box via SSH and start a new R session I can paste the above commands and Chrome server launches with the correct profile and saved passwords required for my purposes.
If, however, I run the exact same commands from RStudio Server this results in an error:
Selenium message:unknown error: Chrome failed to start: exited abnormally.
(chrome not reachable)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10'
System info: host: 'xxx', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.3.0-59-generic', java.version: '1.8.0_252'
Driver info: driver.version: unknown
remote stacktrace: #0 0x55918478e189 <unknown>
Could not open chrome 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.
Some thoughts:
I'm only running the selenium server in non-headless mode as I cannot seem to launch Chrome with a saved profile (and saved passwords) when using the --headless argument.
If I use the --headless argument as above then the sever can be sucessfully launched both from within RStudio Server and an R terminal session
It feels like a permissions issue, and I have experimented with changing the RStudio Server user to my same username that I SSH into the box with, as per these instructions. This does not resolve the problem.
version.string R version 3.6.1 (2019-07-05)
[Package RSelenium version 1.7.7 Index]
Any help appreciated!

Unable to open Gecko Driver with RSelenium package in R without using Docker

I am unable to connect to the Selenium server.
I'm using RSelenium to automate data collection for a school project.
What baffles me is that it has worked every day for two weeks now, but I restarted my macbook so had to reconnect to the Selenium server, and now I can't make it run.
I've tried reinstalling firefox, the geckodriver, the selenium standalone server, and tried running it with chrome.
I've put this in the terminal:
java -jar /Users/x/data/selenium-server-standalone-3.141.59.jar -port 5556
This is what I do in R:
remDr <- RSelenium::remoteDriver(extraCapabilities = list(marionette = TRUE), port=5556)
remDr$open()
I get this error message when running remDr$Open():
Selenium message:Unable to create new service: GeckoDriverService
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'MacBook-Pro-3.local', ip: '[sensitive info removed]', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.3', java.version: '11.0.2'
Driver info: driver.version: unknown
Error: Summary: SessionNotCreatedException
Detail: A new session could not be created.
Further Details: run errorDetails method
I am able to run it with Docker and Tight VNC, but sadly this throws a lot of errors as I need to use the debug version for my data collection.
Hmmm never seen this type of error before. #jdharrison can you look at this?

Using RSelenium to open chrome browser, getting "Unable to create new service: ChromeDriverService" message and error

As the title says, I've got a script written using RSelenium to automate web navigation, using chrome as the browser. This script has worked fine for months now, but today when I tried to run it, I got the following message:
Selenium message:Unable to create new service: ChromeDriverService
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-
02T20:13:22.693Z'
System info: host: 'LAPTOP-22QM8890', ip: '192.168.133.65', os.name:
'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171'
Driver info: driver.version: unknown
Could not open chrome browser.
Client error message:
Summary: SessionNotCreatedException
Detail: A new session could not be created.
Further Details: run errorDetails method
Check server log for further details.
I'm pretty sure that I have installed the latest versions of Chrome and ChromeDriver, but this has not changed anything. I'm at a loss as to what caused this error to spontaneously appear today.
If you are using windows, just go inside C:\Users\Jeff\AppData\Local\binman and delete all directories inside (for me 4 directories including seleniumserver and geckodriver). Then just open RStudio and run eg
library(RSelenium)
rD <- rsDriver(browser = "chrome")
remDr <- rD$client
remDr$navigate("https://google.com")
Good luck.

R error "Selenium message:Unable to create new service: ChromeDriverService"

Hi I'm trying to use RSelenium package in R on Windows 10.
Run command in cmd
java -Dwebdriver.chrome.driver="D:\Selenium\chromedriver.exe"
java -jar D:\Selenium\selenium-server-standalone-3.11.0.jar
and run code in R
remDr <- remoteDriver(browserName = "chrome", remoteServerAddr = "localhost", port = 4444L)
remDr$open()
But I get this following error
[1] "Connecting to remote server"
Selenium message:Unable to create new service: ChromeDriverService
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:15.31Z'
System info: host: '*****', ip: '*****', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_144'
Driver info: driver.version: unknown
Error: Summary: SessionNotCreatedException
Detail: A new session could not be created.
Further Details: run errorDetails method
I downloaded Chrome(V66),The Chrome Webdriver(2.37),The Selenium Stand Alone Driver(3.11.0),all these are new version ,updated lately.
But I still get that error.Could someone please explain to me why?
issue solved.Command in cmd should be like the following code
java -Dwebdriver.chrome.driver="D:\Selenium\chromedriver.exe" -jar D:\Selenium\selenium-server-standalone-3.11.0.jar
I also got this very same issue- which got resolved by including -'chromeDriver.exe' path in command used for registering node.
like- >java -Dwebdriver.chrome.driver=C:\chromedriver_win32\chromedriver.exe -jar selenium-server-standalone-3.12.0.jar -role node -hub http://XX.XXX.XX:4444/grid/register

RSelenium error when connecting to server using Internet Explorer in windows

I try to use the RSelenium in windows with IE as browser as it seems there are some discrepancies with other browsers, and need some fixing with the newer versions.
I do as previously instructed in SO answers:
library(RSelenium)
startServer()
remDr <- remoteDriver(browser="internet explorer")
remDr$open()
remDr$open()
[1] "Connecting to remote server"
Selenium message:Unable to create new remote session. desired capabilities = Capabilities [{nativeEvents=true, browserName=internet explorer, javascriptEnabled=true, version=, platform=ANY}], required capabilities = Capabilities [{}]
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'CL5065F329EBF2', ip: '130.115.158.36', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_91'
Driver info: driver.version: InternetExplorerDriver
Error: Summary: SessionNotCreatedException
Detail: A new session could not be created.
class: org.openqa.selenium.SessionNotCreatedException
Further Details: run errorDetails method
Also when starting server or checking for servers I receive errors regarding deprecated use of the function.
For example:
startServer()
Warning message:
startServer is deprecated.
Users in future can find the function in file.path(find.package("RSelenium"), "example/serverUtils").
The sourcing/starting of a Selenium Server is a users responsiblity.
Options include manually starting a server see vignette("RSelenium-basics", package = "RSelenium")
and running a docker container see vignette("RSelenium-docker", package = "RSelenium")

Resources