英文:
Error using rsDriver of the RSelenium package in R
问题
我正在尝试在R中使用RSelenium包来打开一个浏览器。
使用以下命令时:
rs_driver_object <- rsDriver(browser="chrome",
chromever = "113.0.5672.63",
verbose = F,
port=free_port())
我收到以下错误消息:
Error in gsub("\\s+", ",", ActiveConnections) : input string 1 is invalid
In addition: Warning message:
In gsub("\\s+", ",", ActiveConnections) :
unable to translate ' Proto Adresse locale Adresse distante <90>tat' to a wide string
这是我的代码的前几行,它们工作得很好:
library(tidyverse)
library(RSelenium)
library(netstat)
library(wdman)
# 下载chromedriver
selenium()
# 查找chromedriver的安装位置
selenium_object <- selenium (retcommand = T, check = F)
# 要使用的版本
binman::list_versions("chromedriver")
这是我的Google Chrome版本:113.0.5672.127
这是带有binman的行的结果:
$win32
"113.0.5672.24" "113.0.5672.63" "114.0.5735.16"
所以使用chromedriver的版本113.0.5672.63应该可以工作。
我认为错误来自于free_port()函数,它允许我找到一个空闲的端口。我尝试过不使用它,但如果我不指定要使用的端口,或者使用一个随机端口,它可能会告诉我该端口已经被使用,因此无法工作。我希望找到一种每次都能正常工作的方法,所以free_port()可能是一个不错的选择,如果它能正常工作的话。
英文:
I am trying to open a browser using the RSelenium package in R.
When using this command
rs_driver_object <- rsDriver(browser="chrome",
chromever = "113.0.5672.63",
verbose = F,
port=free_port())
I get this error
Error in gsub("\\s+", ",", ActiveConnections) : input string 1 is invalid
In addition: Warning message:
In gsub("\\s+", ",", ActiveConnections) :
unable to translate ' Proto Adresse locale Adresse distante <90>tat' to a wide string
Here are the first lines of my code, they work well
library(tidyverse)
library(RSelenium)
library(netstat)
library(wdman)
# To download chromedriver
selenium()
# To find where chromedriver is installed
selenium_object <- selenium (retcommand = T, check = F)
# Versions to use
binman::list_versions("chromedriver")
Here is my Google Chrome version : 113.0.5672.127
and here is the result of the line with binman :
$win32
"113.0.5672.24" "113.0.5672.63" "114.0.5735.16"
So using the 113.0.5672.63 version of chromedriver should work.
I think the error comes from free_port() which allows me to find a free port. I have tried not to use but if I don't say which port I'm using or if I use a random port, it can tell me that the port is already in use and so it doesn't work. I would like something that works every time, so free_port() would be a good fit if it would work.
答案1
得分: 1
我遇到了同样的问题。这不是RSelenium
包的问题,而是在netstat
中。我在命令提示符中键入了netstat -s -p tcp
,发现统计信息是以我的本地语言显示的。在开发人员解决此问题之前,您需要将操作系统的语言更改为英语。
英文:
I came across the same problem. It isn't a problem in the RSelenium
package, it's in the netstat
. I've typed netstat –s –p tcp
in my command prompt and saw that the statistics were coming out in my local language. Until developers resolve this, you've to change your OS language to English.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论