MAC中的RSelenium [英] RSelenium in MAC

查看:69
本文介绍了MAC中的RSelenium的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在OS X Yosemite(10.10.4)上使用R R 3.1.1.我最近安装了RSelenium,并且不断收到未知错误.我使用的代码如下:

I am using R R 3.1.1 on OS X Yosemite(10.10.4). I have recently installed RSelenium and I constantly receive an unknown error. The code that I use is as follow:

require(RSelenium)
checkForServer()
startServer()
Sys.sleep(5)
remDr <- remoteDriver()
remDr$open()

错误如下:

remDr $ open()[1]连接到远程服务器"RCurl调用中发生未定义的错误.queryRD(paste0(serverURL,"/session"),"POST",qdata = toJSON(serverOpts))中的错误:

remDr$open() [1] "Connecting to remote server" Undefined error in RCurl call. Error in queryRD(paste0(serverURL, "/session"), "POST", qdata = toJSON(serverOpts)) :

我尝试从官方网站下载selenium-java-2.41.0.然后,我将文件放在Library/Java/Extension中.然后我尝试了这一行代码

I tried downloading the selenium-java-2.41.0 from the official website. Then I put the file in the Library/Java/Extension. Then I tried this line of code

system("java -jar ~/Library/Java/Extension/selenium-2.47-2.1/selenium-java-2.47.1.jar")

但是它没有用,我一直收到同样的错误.

But it did not worked and I kept on receiving the same error.

然后我使用终端安装软件包,如下所示:

Then I used the terminal to install the package like this:

sudo java -jar selenium-server-standalone-2.47.1.jar

它安装了一些东西,但问题仍然没有解决.我不知道该怎么办.

It installed something but still the problem did not solved. I have no idea what else to do.

推荐答案

这是Mac的安全问题.您需要从 http://www.seleniumhq.org/download/下载独立的硒服务器,将其与要运行的脚本放在同一目录中,然后运行它.您的安全设置可能会阻止这种情况,因为它是未经身份验证的",这意味着您必须进入安全设置并手动覆盖.之后,它将正常工作.

It's a security issue for Mac's. You need to download the standalone selenium server from http://www.seleniumhq.org/download/, put it in the same directory as the script you are trying to run, then run it. Your security settings might prevent this because it's "not authenticated," which means you'll have to go to your security settings and manually override. After that, it'll work fine.

来源:

http://www.computerworld.com/article/2971265/application-development/how-to-drive-a-web-browser-with-r-and-rselenium.html

这篇关于MAC中的RSelenium的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆