【发布时间】:2016-08-23 00:29:40
【问题描述】:
最近,我在 RSelenium 下驱动 phantomjs 时遇到了麻烦。似乎浏览器无法使用findElement() 在页面上找到任何内容。如果我传递一些简单的东西:
library("RSelenium")
RSelenium::checkForServer()
RSelenium::startServer()
rd <- remoteDriver(browserName = "phantomjs")
rd$open()
Sys.sleep(5)
rd$navigate("https://www.Facebook.com")
searchBar <- rd$findElement(using = "id", "email")
我收到以下错误:
Error: Summary: NoSuchElement
Detail: An element could not be located on the page using the given search parameters.
class: org.openqa.selenium.NoSuchElementException
对造成这种情况的原因有什么想法吗?我导航到哪个页面似乎并不重要。每当我尝试在网页上定位元素时,它都会失败。这个问题最近开始出现,当我的 cron 作业开始失败时,我注意到了它。
我正在使用 R 3.3.1 和 phantomjs 2.1.1 在 Ubuntu 14.04 LTS 中工作。我不怀疑存在某种类型的兼容性问题,因为这是最近才起作用的,而且我还没有更新任何东西。
【问题讨论】:
-
Google 是一个简单的工作示例。无论站点如何,它都会引发错误。我可以更新问题以排除 Google,但这似乎无关紧要
-
抱歉,如果您有这样的印象。我从来没有真正从谷歌上抓取内容,也没有意识到违规行为。已更新问题以排除 Google。