RSelenium运行出错解决办法

1. 运行remDr$open()报错

[1] "Connecting to remote server"
Error:   Summary: UnknownError
     Detail: An unknown server-side error occurred while processing the command.
     class: org.openqa.selenium.WebDriverException

解决方向:
(1). RSelenium默认浏览器的打开路径一定是在C盘program files里面的,所以firefox最好默认安装路径;
(2). Selenium 2.53 跟 firefox 47兼容不好,需要下载这个驱动Marionette driver (https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver);要不就使用firefox 46版本(参考:http://stackoverflow.com/questions/37693106/selenium-2-53-not-working-on-firefox-47)。

2. 使用Chrome启动

(1). 缺省支持的是 firefox,其他浏览器需要安装驱动;
(2). 如果需要启用Chrome,需要先下载ChromeDriver.exe, 然后在环境变量中设置这个文件的路径。参考
http://stackoverflow.com/questions/33124857/rselenium-is-not-working
http://stackoverflow.com/questions/31124702/rselenium-unknownerror-java-lang-illegalstateexception-with-google-chrome

3. 如果还是出错,可以使用无头浏览器(phantomjs)方式启动

require(RSelenium)
# 切换selenium-server-standalone.jar 的路径
setwd("D:\\Program Files\\R\\R-3.3.1\\library\\RSelenium\\bin")
startServer()
remDr <- remoteDriver(browserName = 'phantomjs')
remDr$open()
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容