I'm trying to use Selenium for the first time in my computer. But I'm having an error in the first line:
My code:
library(RSelenium)
rD <- rsDriver(browser = "firefox")
Error message:
checking Selenium Server versions: BEGIN: PREDOWNLOAD BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD checking chromedriver versions: BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD BEGIN: POSTDOWNLOAD checking geckodriver versions:
BEGIN: PREDOWNLOAD BEGIN: DOWNLOAD BEGIN: POSTDOWNLOAD checking
phantomjs versions: BEGIN: PREDOWNLOAD BEGIN: DOWNLOAD BEGIN:
POSTDOWNLOAD
[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: Conection Refused
Check server log for further details.
Warning message:
In rsDriver(browser = "firefox") : Could not determine server status.
My OS is Linux Mint, 19.3, Cinnamon.
I installed selenium-server-standalone-3.141.59.jar and geckodriver-v0.26.0
Try this FIRST:
suppressWarnings(tryCatch(rm(remDr),error=function(e){}))
suppressWarnings(tryCatch(rD),error=function(e){}))
gc()
#relaunch
library(RSelenium)
rD <- rsDriver(browser = "firefox")
remDr <- rD$client
remDr$navigate("https://www.duckduckgo.com")
Alternatively this:
#make sure lsof is installed on your system:
#sudo apt-get install ssh-askpass lsof
system("kill -9 $(lsof -t -i:4567 -sTCP:LISTEN)")
#might need to be run sudo depending on your system
system("sudo kill -9 $(lsof -t -i:4567 -sTCP:LISTEN)")
#relaunch
library(RSelenium)
rD <- rsDriver(browser = "firefox")
remDr <- rD$client
remDr$navigate("https://www.duckduckgo.com")
If none of that works, you may have installed the wrong geckodriver. Uninstall geckodriver from linux (sudo apt-get remove geckodriver --purge) and uninstall RSelenium from R (remove.packages("RSelenium")). Then DO NOT re-install geckodriver, but make sure you have all firefox dependencies (run sudo apt-get install firefox). Re-install RSelenium (in R), then try re-launching again without manually downloading geckodriver. In this way RSelenium will automatically download the correct geckodriver version.
Related
I'm trying to use RSelenium, and when I'm trying to use rsDriver, I keep getting a weird error that I'm not sure how to handle. My code is as follows:
library(RSelenium)
library(rvest)
library(XML)
rD <- rsDriver(port = 4567L, browser = "chrome")
remDr <- rD$client
As I'm running the code, I get the following error:
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking chromedriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking geckodriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking phantomjs versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
[1] "Connecting to remote server"
Selenium message:Timed out waiting for driver server to start.
Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10'
System info: host: 'Stephens-MacBook-Pro.local', ip: '2601:647:5680:6250:0:0:0:e510%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '11.5.2', java.version: '1.8.0_333'
Driver info: driver.version: 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.
Any advice as to what the error might be would be greatly appreicated!
My code:
driver <- rsDriver(browser="chrome", port=4234L, chromever = "89.0.4389.23")
and output:
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking chromedriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking geckodriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking phantomjs versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
[1] "Connecting to remote server"
Selenium message:Timed out waiting for driver server to start.
Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10'
System info: host: 'blah.blah.blah', ip: '2601:602:9403:400:0:0:0:f690%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.7', java.version: '15.0.2'
Driver info: driver.version: 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.
I have also used chromever="latest" and tried different ports. The selenium-server-standalone.jar is in the working directory as well as the chromedriver.exe in case that is important.
I have been able to start a selenium server on this port from the command line using the same .jar and .exe files and then tried the code
browser <- remoteDriver(port = 4234L, browserName = "chrome")
browser$open()
only to get the error:
Selenium message:Unable to create new service: ChromeDriverService
Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10'
System info: host: 'blah.blah.blah', ip: '2601:602:9403:400:0:0:0:f690%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.7', java.version: '15.0.2'
Driver info: driver.version: unknown
Error: Summary: SessionNotCreatedException
Detail: A new session could not be created.
Further Details: run errorDetails method
I feel as if the "Driver info: driver.version: unknown" is the problem, which I think refers to the chromedriver but I'm not sure. I am quite positive that "89.0.4389.23" is my chrome version and that java, selenium, chrome are all very up-to-date versions.
Any thoughts would be appreciated, thanks.
I run
require(RSelenium)
driver <-
rsDriver(
browser = c("chrome"),
chromever = "83.0.4103.14",
port = as.integer(4445L)
)
which returns
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking chromedriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking geckodriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking phantomjs versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
[1] "Connecting to remote server"
Could not open chrome browser.
Client error message:
Undefined error in httr call. httr output: Failed to connect to localhost port 1242: Connection refused
Check server log for further details.
I get the same problem attempting to use the remoteDriver function with docker:
system("sudo docker pull selenium/standalone-chrome",wait=T)
Sys.sleep(5)
system("sudo docker run -d -p 4445:4444 selenium/standalone-chrome",wait=T)
Sys.sleep(5)
#remDr <- remoteDriver(port=4445L, browserName="chrome")
remDr <- RSelenium::remoteDriver(remoteServerAddr = "192.168.99.100",
port = 4445L, browserName = "chrome")
remDr$open()
It doesn't work for firefox, and up until now it has been working perfectly with the exact same code. Any help would be much appreciated (I've been through the other answers on this error message and can't find anything that fixes it).
Finally solved this. If you run:
sel <- wdman::selenium()
sel$log()
it should show you any errors thrown up when trying to initialise selenium. In this case the path to the java binary was incorrect (no idea why it changed on its own).
So I simply re-followed the steps mentioned here: "PATH to JAVA not found. Please check JAVA is installed." error when initialising RSelenium
and it worked.
At the moment I am getting this error and don't really know how to fix it.
I only get it while working on a Packrat R project.
install.packages("dplyr")
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to cran.rstudio.com:443
Error in download.file(url, destfile, method, mode = "wb", ...) :
'curl' call had nonzero exit status
I recently updated my MacOS version, as well as my R version.
I tried installing libressl/openssl via brew.
Here is the solution I found for this problem
Install or upgrade libressl, openssl, curl
Restart your computer (this is important)
On Mac terminal:
brew install libressl
brew install openssl
brew install curl
I am having problems to install the package lme4 in R.
Following the output. It looks like it can't open nlopt. Someone knows how to solve it?
I am in Linux 16.10
checking nlopt.h usability... no
checking nlopt.h presence... no
checking for nlopt.h... no
configure: Need to download and build NLopt
trying URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Error in download.file(url = "http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz", :
cannot open URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Execution halted
/bin/tar: This does not look like a tar archive
gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error is not recoverable: exiting now
Warning message:
In untar(tarfile = "nlopt-2.4.2.tar.gz") :
'/bin/tar -xf 'nlopt-2.4.2.tar.gz'' returned error code 2
configure: Starting to install library to /tmp/Rtmp1o9ETL/R.INSTALL2a78412beb2/nloptr/nlopt-2.4.2
./configure: line 3325: cd: nlopt-2.4.2: No such file or directory
Briefly:
There is no such thing as "Linux 16.10'
There is Ubuntu 16.10
[Optional] On Ubuntu, see this README from CRAN on how to get R and some packages prebuilt from CRAN
Irregardless, and answered here before checking for nlopt.h... no is the hint: do sudo apt-get install libnlopt-dev and try again.
You can get both r-cran-nloptr and r-cran-lme4 from Ubuntu too but those may be older versions given that your OS is 16.04, ie from 2016.