error with RSelenium - r

after a lot with struggle to get the docker running correctly, i have the following error when trying to use RSelenium:
Selenium message:The path to the driver executable must be set by the
webdriver.gecko.driver system property; for more information, see
https://github.com/mozilla/geckodriver. The latest version can be downloaded
from https://github.com/mozilla/geckodriver/releases
Error: Summary: UnknownError
Detail: An unknown server-side error occurred while processing the command.
class: java.lang.IllegalStateException
Further Details: run errorDetails method
The code is just:
remDr <- remoteDriver(remoteServerAddr = "localhost"
, port = 4444
, browserName = "firefox"
)
remDr$open()
And whe I try to see the page https://github.com/mozilla/geckodriver, i get error 404. Anyone knows what is this about? Im using windows.

Related

RSelenium can't connect to host rsDriver()

Until recently, I was using RSelenium without any problem. When I try to connect to hostr rsDriver() to start a selenium server and browser, I get the following error message:
Could not open firefox browser.
Client error message:
Undefined error in httr call. httr output: Failed to connect to localhost port 5111: Connection refused
Check server log for further details.
Warning message:
In rsDriver(browser = "firefox", port = 5111L, verbose = F) :
Could not determine server status.
I have looked at some answers already proposed, like in this page. However, when I run the command,
> selServ <- wdman::selenium(verbose = FALSE)
> selServ$log()
I get the following error message:
$stderr
[1] "Error: Could not find or load main class c(-Dwebdriver.chrome.driver="C:\\\\Users\\\\user\\\\AppData\\\\Local\\\\binman\\\\binman_chromedriver\\\\win32\\\\109.0.5414.25.chromedriver.exe\","
$stdout
character(0)
I tried to reinstall Java, but without success.
Ok I just solved the issue. The issue was that RSelenium recognises the chromedriver even when using other browsers so when the driver is not compatible to your current chrome version, it would have an issue with rsDriver. In order to solve this, you can either input NULL next to chromever or older chrome driver version from C:\Users\NAME\AppData\Local\binman\binman_chromedriver\win32
rD <- rsDriver(port= sample(7600)[1], browser=c("firefox"), chromever = NULL)
rD <- rsDriver(port= sample(7600)[1], browser=c("firefox"), chromever = 108.0.5359.22)

R Rselenium ".... Failed to connect to localhost port 4444: Connection refused"

Seeking guidance on how to resolve the subject line error.
The many previous posts and solutions referenced here have already been reviewed/tried.
In the past this same error has been resolved by updating R, Rselenium, Selenium Server (selenium-server-4.1.3.jar), Java, Chrome browser, Chromedriver and/or Gecko Driver (when using Firefox). All were updated to the latest versions. Also tried Firefox. Error remains.
Windows 10 was updated/computer rebooted. No joy.
The code, which has worked for years and as recently as two weeks ago:
remDr <- remoteDriver(browserName = "chrome")
remDr$open(silent = TRUE)
Error message and parameters:
Error in checkError(res) :
Undefined error in httr call. httr output: Failed to connect to localhost port 4444: Connection refused
remDr
$remoteServerAddr
[1] "localhost"
$port
[1] 4444
$browserName
[1] "chrome"
$version
[1] ""
$platform
[1] "ANY"
$javascript
[1] TRUE
$nativeEvents
[1] TRUE
$extraCapabilities
list()
What else should I examine or try?
The solution was to revert back to selenium-server-standalone-3.9.1.jar.
For folks trying to set this up for the first time, the steps that work for me are to run a batch file (.cmd) with the following two lines before running the R file.
java -jar selenium-server-standalone-3.9.1.jar
pause
Of course, edit the first line to match the file name as new selenium server versions release. Place the .jar file and browser drivers in a folder that's in the system search path (I edit the system path to include a custom folder that's dedicated to RSelenium related files).
When the command box pops up, you should see the following line:
07:35:53.054 INFO - Selenium Server is up and running on port 4444
My big mistake was not to double check for that line, once I returned to this with fresh eyes I realized that I should look for that line, then the solution was obvious.
Then these RSelenium commands work:
remDr <- remoteDriver(browserName = "chrome")
remDr$open(silent = TRUE)

Why can't I establish the connection?

I am trying to scrape some comments from a job feedback web site using RSelenium.
I am facing a following problem when I try to run this line of code:
library(RSelenium)
rs <- rsDriver(browser = "firefox", check = FALSE)
And then the problem pops up:
[1] "Connecting to remote server"
Could not open firefox browser.
Client error message:
Undefined error in httr call. httr output: Failed to connect to localhost port 4567: Connection refused
Check server log for further details.
Warning:
В rsDriver(browser = "firefox", check = FALSE) :
Could not determine server status.
The latest Java and Mozilla Firefox versions are installed onto my laptop. Also added the path to Java's bin in the Win system options. I have no clue why this problem occurs.

RSelenium could not navegate with Chrome

I have problems trying to implement package RSelenium on R. I already begin with the process, I downloaded selenium (selenium-server-standalone-3.5.3.jar) and Google Chrome's web driver (chromedriver.exe). I also included in the environment variables, in path, the location of both files and a variable to the java location.
Then, I begin whit code:
> require(RSelenium)
> remDr <- remoteDriver(browserName = "chrome")
> remDr$open()
This open the following window:
Later, when I try navegate some page I obtain the following error:
> remDr$navigate("http://www.la14.com")
Selenium message:unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"8112.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=60.0.3112.113)
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64)
Error: Summary: UnknownError
Detail: An unknown server-side error occurred while processing the command.
Further Details: run errorDetails method
I don't know if it is related with browser permissions. I will grateful with your help.
Your issue is that your are using a chromedriver that is too old. You are using 2.9 and latest one is 2.32.
Download the latest chromedriver from below link
https://chromedriver.storage.googleapis.com/index.html?path=2.32/
And then replace the old one. This should work

RSelenium, Can't start server

I'm trying to use RSelenium for web-scraping purposes behind a login and I can't get the server to run.
Current result:
library(RSelenium)
startServer()
remDr <- remoteDriver(port = 4444,
browserName = "firefox")
remDr$open()
# [1] "Connecting to remote server"
Error: Summary: UnknownError
Detail: An unknown server-side error occurred while processing the command.
class: org.openqa.selenium.firefox.NotConnectedException
I've tried running the server myself by downloading and trying to open it (nothing happens).
This was a tough one and stopped me for a couple of days when I could search on it. In the end I uninstalled Firefox and installed version 37.0 while also disabling the update service. That fixed it for me and RSelenium works fine again.
Run the following code first then it should work:
RSelenium::checkForServer()
This line of code installs the selenium server which you need for running RSelenium commands.
Try below.
rD <- rsDriver(port=4444L,browser="firefox")
mybrowser <- remoteDriver(browserName = "firefox")
mybrowser$open()
RSelenium has problems to establish serwer at the begginig on respective port. Subsequently we are telling which driver should be used.

Resources