根据在Docker中使用RSelenium的在线文档,我已经安装了Docker工具箱和RSelenium。 在Docker工具箱中,我运行 $ docker run -d -p 4445:4445 selenium/standalone-chrome 和 $ docker ps, 并获得以下输出。 ? 然后,我在R中运行以下代码: library(RSelenium)
library(Rvest) #not sure if I need this?
#192.168.99.100 is my IP
remDr <- RSelenium::remoteDriver(remote
我想通过以下代码在动态web上刮取数据:
> URL<- "http://www.cbooo.cn/realtime"
> library(bitops)
> library(RCurl)
> library(XML)
> library(RSelenium)
> library(magrittr)
> checkForServer()
Warning message:
checkForServer is deprecated.
Users in future can find the function in file.path(
在过去的几个月里,我一直在学习R编程,我真的很喜欢这门语言。我想开始用它来实现工作中的一些事情的自动化。然而,对于我的生活,无论我有多少谷歌或实验,我似乎无法启动浏览器。
我遵循了本文中的步骤
从命令行开始服务器。这是我在控制台中运行的代码和正在获取的错误消息。
> library(RSelenium)
> checkForServer()
Warning message:
checkForServer is deprecated.
Users in future can find the function in
file.path(find.package("RSel
我想使用RSelenium从网页中删除div元素。这里是我想要删除<div id="header">的MWE。我能找到元素。我怎么能让它消失?
米维
library(RSelenium)
url <- 'https://ropensci.org'
## These two lines will pull the latest docker image of firefox and run it
system("docker pull selenium/standalone-firefox:latest")
system(
每当我尝试使用RSelenium包时,都会出现上述错误
shell('docker run -d -p 4445:4444 selenium/standalone-chrome')
docker: error during connect: Post
http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.30/containers/create: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configur
我的操作系统是windows 8.1,我使用的是R的3.3.3版。
我已经安装了RSelenium包,并尝试使用以下命令运行它:
library("RSelenium")
#start RSelenium server
startServer()
checkForServer()
我收到了这个错误:
Error: checkForServer is now defunct. Users in future can find the function in
file.path(find.package("RSelenium"), "examples/se
我正在尝试启动一个RSelenium会话来进行网络抓取。但是,在运行此代码时: driver <- rsDriver(browser=c("chrome"), chromever="76.0.3809.126", port = 4444L) 我得到这个错误:Error in java_check() : PATH to JAVA not found. Please check JAVA is installed. 我已经安装了正确的Java版本--我想我需要在R中设置Java的路径,但是我不知道怎么做。我是一名数据科学家,对任何计算机的工作原理一无
几天前,我询问并回答了,使Rselenium运行良好。
现在我不能再导航了,我不认为有什么改变,所以我很困惑。
shell('docker run -d -p 4445:4444 selenium/standalone-chrome')
remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "chrome")
remDr$navigate("http://www.google.com") # used to work
我正在尝试使用Rselenium抓取一个网站。然而,我得到了一个错误:
Error: checkForServer is now defunct. Users in future can find the function in
file.path(find.package("RSelenium"), "examples/serverUtils"). The
recommended way to run a selenium server is via Docker. Alternatively
see the RSelenium::rsDriver func
我使用docker运行Selenium,如下所示:
docker run -d -p 4445:4444 selenium/standalone-firefox:2.53.1
下面的R脚本中的这一行remDr$findElement(using = "class", "percent")运行良好。
library("tidyverse")
library("RSelenium")
# A Selenium server has to be running
# Works with: docker run -d -p 4445:4
我的目标是从URL下载图像。在我的例子中,我不能使用download.file,因为我的图片位于一个需要登录的网页中,在真实图像可见之前,它在后台运行了一些java脚本。这就是为什么我需要使用RSelenium包来完成它的原因。
正如建议的一样,我已经构建了一个带有独立铬标记的码头容器。码头码头的输出:
$ docker-machine ip
192.168.99.100
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS
我看过和,但无法解决我的问题。这并没有帮助这个人在Windows上,而我在Mac上(El Capitan,10.11.6版)
我正在尝试学习使用RSelenium进行数据抓取,但是它的一些技术方面给我带来了早期的问题。我先有几个问题,然后分享我的代码:
(1)现在,它说startServer()被废弃了。具体而言,是:
startServer()
# output
Warning message:
startServer is deprecated.
Users in future can find the function in
file.path(find.package("R
很抱歉问了两个无关的问题。
访问docker容器的主机的最佳方法是什么(例如,我试图从我的docker容器中访问运行在主机上的kafka实例,以便发布一些消息)
当我在可能出现问题/语法错误的图像上运行docker run .....时,它自然不会启动--是否有一个日志文件可以让我查看来调试这个问题。(这个问题与第一个问题有些关联,因为我做了另一篇文章中的建议,但图片还没有开始)
我一直在运行这段代码,但突然间它返回了以下错误:
open.connection中的错误(con,"rb"):HTTP错误403
我没有改变什么,我也不知道为什么会发生这种事。有什么建议吗?谢谢!
#Loading the rvest package
library(rvest)
library(magrittr) # for the '%>%' pipe symbols
library(RSelenium) # to get the loaded html of
library(purrr) # for '
我试着用RSelenium打开一个远程驱动程序,但是我仍然面临着与Docker相同的问题。
在码头内我跑
$ docker run -d -p 4445:4444 selenium/standalone-firefox:2.53.0
然后
$ docker ps
码头工人返回
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a89435c68373 selenium/standalone-firefox:2.53.0 "/opt/bin/entry_poin…" About an hour ago Up About a