java AWS上的 selenium 含量:无法确定服务器状态

cld4siwp  于 2023-01-04  发布在  Java
关注(0)|答案(1)|浏览(117)

我试图在AWS上运行RSelenium,但遇到了一些错误(我以前让它在不同的AWS上工作(不再可用))。
我收到以下错误:

> library(tidyverse)
> library(RSelenium)
> 
> rD <- RSelenium::rsDriver(
+   port = 4454L,
+   browser = c("firefox"),
+   version = "latest"
+ )
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 4454 after 0 ms: Connection refused
Check server log for further details.
Warning message:
In RSelenium::rsDriver(port = 4454L, browser = c("firefox"), version = "latest") :
  Could not determine server status.
[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 4454 after 0 ms: Connection refused
Check server log for further details.
Warning message:
In RSelenium::rsDriver(port = 4454L, browser = c("firefox"), version = "latest") :
  Could not determine server status.

我试过遵循一些网上所以suggests没有运气。
我已经运行的其他事情(在终端中)

ubuntu@ip-172-31-36-112:~$ whereis java
java: /usr/bin/java /usr/share/java /usr/share/man/man1/java.1.gz

ubuntu@ip-172-31-36-112:~$ java -version
openjdk version "11.0.17" 2022-10-18
OpenJDK Runtime Environment (build 11.0.17+8-post-Ubuntu-1ubuntu222.04)
OpenJDK 64-Bit Server VM (build 11.0.17+8-post-Ubuntu-1ubuntu222.04, mixed mode, sharing)

R中,我运行了以下代码:

> sel = wdman::selenium()
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
> sel$process
PROCESS 'file269f704d94ce.sh', finished.
> sel$output()
character(0)
> sel$error()
character(0)
> sel$stop()
[1] FALSE
> sel$log()
$stderr
[1] ""

$stdout
[1] ""

我得到了更多的信息运行:

> rsDriver(port = 4567L,
+          browser = c("chrome", "firefox", "phantomjs", "internet explorer"),
+          version = "latest",
+          chromever = "latest",
+          geckover = "latest",
+          iedrver = NULL,
+          phantomver = "2.1.1",
+          verbose = TRUE,
+          check = TRUE)
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 4567 after 0 ms: Connection refused
Check server log for further details.
$client
[1] "No sessionInfo. Client browser is mostly likely not opened."

$server
PROCESS 'file269f1793fdb5.sh', finished.
Warning message:
In rsDriver(port = 4567L, browser = c("chrome", "firefox", "phantomjs",  :
  Could not determine server status.
$client
[1] "No sessionInfo. Client browser is mostly likely not opened."

会话信息

> sessionInfo()
R version 4.2.0 alpha (2022-03-28 r82012)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.1 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8        LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C           LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] RSelenium_1.7.9 forcats_0.5.2   stringr_1.5.0   dplyr_1.0.10    purrr_1.0.0     readr_2.1.3     tidyr_1.2.1     tibble_3.1.8   
 [9] ggplot2_3.4.0   tidyverse_1.3.2

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.9          lubridate_1.9.0     binman_0.1.3        ps_1.7.2            assertthat_0.2.1    utf8_1.2.2          R6_2.5.1           
 [8] cellranger_1.1.0    backports_1.4.1     reprex_2.0.2        httr_1.4.4          pillar_1.8.1        rlang_1.0.6         curl_4.3.3         
[15] googlesheets4_1.0.1 readxl_1.4.1        rstudioapi_0.14     googledrive_2.0.0   wdman_0.2.6         munsell_0.5.0       broom_1.0.2        
[22] compiler_4.2.0      modelr_0.1.10       pkgconfig_2.0.3     tidyselect_1.2.0    fansi_1.0.3         crayon_1.5.2        withr_2.5.0        
[29] tzdb_0.3.0          dbplyr_2.2.1        rappdirs_0.3.3      bitops_1.0-7        grid_4.2.0          jsonlite_1.8.4      gtable_0.3.1       
[36] lifecycle_1.0.3     DBI_1.1.3           magrittr_2.0.3      semver_0.2.0        scales_1.2.1        cli_3.5.0           stringi_1.7.8      
[43] fs_1.5.2            xml2_1.3.3          ellipsis_0.3.2      generics_0.1.3      vctrs_0.5.1         tools_4.2.0         glue_1.6.2         
[50] hms_1.1.2           yaml_2.3.6          processx_3.8.0      timechange_0.1.1    colorspace_2.0-3    gargle_1.2.1        caTools_1.18.2     
[57] rvest_1.0.3         haven_2.5.1

我有RSelenium在我的个人笔记本电脑上工作,我已经检查了软件包是相同的/最新的。

hmtdttj4

hmtdttj41#

我也遇到了同样的问题,我运行的是Ubuntu 22.10的R 4.2.2和RSelenium 1.7.9,我运行的代码行是:

rD <- RSelenium::rsDriver(browser = "firefox", port = 3040L, verbose = T, check = F,
                            extraCapabilities = list("moz:firefoxOptions" = list(
                              args = list('--headless')
                            )))

我收到了以下错误消息:
[1]无法打开Firefox浏览器。客户端错误消息:在htr调用中出现未定义的错误。htr输出:0毫秒后无法连接到本地主机端口3040:连接被拒绝有关详细信息,请查看服务器日志。警告消息:在RSelenium::rsDriver(浏览器=“firefox”,端口= 3040L,详细信息= T,:无法确定服务器状态。

相关问题