我正在尝试使用 RSelenium 从这个国家河流流量档案(英国)网站: http : //nrfa.ceh.ac.uk/data/station/info/69032 中抓取年度最大流量数据。我找不到协商下拉菜单的方法。目前我可以使用以下方法半自动化该过程:
library(RSelenium)
checkForServer()
startServer()
remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4444, browserName = "firefox", platform = "LINUX")
remDr$open()
i <- "69032"
remDr$navigate(paste0("http://nrfa.ceh.ac.uk/data/station/peakflow/", i))
# read the raw html and parse
doc<-htmlParse(remDr$getPageSource()[[1]])
peak.flows <- as.numeric(readHTMLTable(doc)$tablesorter[, "Flow (m3/s)"])
这有点小技巧,我不得不点击页面上的几个按钮,而不是让 RSelenium 来做。关于 RSelenium 如何从下拉菜单中选择“峰值流量数据”选项卡和“最大年度 (AMAX) 数据”选项有什么建议吗?