I wan't to use Selenium for webscrapping from R.
However, when defining the driver object I get the following error:
Could not open chrome browser.
Client error message:
Undefined error in httr call. httr output: Failed to connect to localhost port 14415: Connection refused
Check server log for further details.
Warning message:
In rsDriver(browser = "chrome", chromever = "109.0.5414.74", verbose = FALSE, :
Could not determine server status.
When checking the server log for further details I get:
Could not find or load main class c(-Dwebdriver.chrome.driver=\"C:\\\\Users\\\\xherr\\\\AppData\\\\Local\\\\binman\\\\binman_chromedriver\\\\win32\\\\109.0.5414.74.chromedriver.exe\","
Here's my code:
library(tidyverse)
library(RSelenium)
library(netstat)
library(Rcpp)
library(wdman)
binman::list_versions("chromedriver")
rdriver <- rsDriver(browser = "chrome",
chromever = "109.0.5414.74",
verbose = TRUE,
port = free_port())
rdriver$server$log()
Does anyone know how to fix this? Thank you very much
I recommend 'remoteDriver' instead of 'rsDriver'
binman::list_versions(appname = 'chromedriver')
driver<-wdman::chrome(port=4576L, version = '108.0.5359.71')
# first data
remote<-remoteDriver(port=4576L, browserName='chrome')
remote$open()
I have experienced exactly the same issue since I upgraded to chromedriver 109.0.5414.74. It might be a problem with the latest chromedriver version.
The only way I make rsDriver to run again was by replacing in your code 109.0.5414.74 by 108.0.5359.71.
Try:
library(tidyverse)
library(RSelenium)
library(netstat)
library(Rcpp)
library(wdman)
binman::list_versions("chromedriver")
rdriver <- rsDriver(browser = "chrome",
chromever = "108.0.5359.71",
verbose = TRUE,
port = free_port())
rdriver$server$log()
The chrome driver version "109.0.5414.74" now includes an additional file that confuses wdman/binman. Using an earlier version like chromever = "108.0.5359.71"
will work. Alternatively you can use the newer drivers by finding your chrome driver path using selenium(retcommand = T) and deleting the LICENSE.chromedriver files
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.