【发布时间】:2016-08-31 20:02:52
【问题描述】:
我正在尝试使用 RSelenium 对 javascript 进行网页抓取,但我无法完全完成。使用 css 选择器我可以单击第一个底部,但是当我进入第二步时,我必须在地图上选择一个状态,我收到以下错误:
“错误:摘要:UnknownError 详细信息:处理命令时发生未知的服务器端错误。 类:org.openqa.selenium.WebDriverException"
library(RSelenium)
url<-"http://www.cnj.jus.br/corregedoria/justica_aberta/?"
startServer()
mb <- remoteDriver(browserName="chrome")
mb$open()
mb$navigate(url)
mb$findElement(using="css selector","fieldset:nth-child(5) a:nth-child(4) strong")
mb$findElement(using="css selector","fieldset:nth-child(5) a:nth-child(4) strong")
s<-mb$findElement(using="css selector","fieldset:nth-child(5) a:nth-child(4) strong")
s$clickElement() # Until here everything is fine.
#this part below doesn't work:
d<-mb$findElement("css selector", 'area:nth-child(4)')
d$clickElement() # here a I get the error mentioned above.
我将不胜感激。
【问题讨论】:
-
不幸的是,单击图像地图是problematic,但您可以抓取地图/区域 HTML 标记并尝试从中执行 javascript(使用网络检查器查看我在说什么)。
-
您的建议效果很好。非常感谢。
标签: r web-scraping rselenium