I am simply trying to launch a driver with RSelenium with the following code. The code worked fine a few weeks ago and now it's throwing an errror:
library(RSelenium)
library(rvest)
library(tidyverse)
driver <- rsDriver(port = 4845L, browser = "chrome", version = "3.141.59")
remdriv <- driver$client
The error is this:
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
Warning: Could not determine server status.[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 4845: Connection refused
Check server log for further details.
I have then gone on to run the following code:
library(wdman)
selServ <- wdman::selenium(verbose = FALSE)
selServ$log()
Which told me that:
$stderr
[1] "Error: Could not find or load main class c(-Dwebdriver.chrome.driver=\"C:\\\\Users\\\\Name\\\\AppData\\\\Local\\\\binman\\\\binman_chromedriver\\\\win32\\\\109.0.5414.25.chromedriver.exe\","
[2] "Caused by: java.lang.ClassNotFoundException: c(-Dwebdriver.chrome.driver=\"C:\\\\Users\\\\Name\\\\AppData\\\\Local\\\\binman\\\\binman_chromedriver\\\\win32\\\\109.0.5414.25.chromedriver.exe\","
$stdout
character(0)
I found the above on this post. But I'm not clear on what I need to do to fix the issue. If anyone has any ideas let me know. Thanks.
CodePudding user response:
I was able to connect after using binman::list_versions("chromedriver") to list the chromedriver options and then used one of those within the driver call, so it now looks like this and opens the window:
driver <- rsDriver(port = 4842L, browser = "firefox", chromever = "102.0.5005.27")
remdriv <- driver$client
Thanks to @RicVillalba for the answer