使用 RSelenium 下载 PDF

问题描述 投票:0回答:0

我正在尝试使用“县”级别选项从该网站下载多个 pdf——https://public.education.mn.gov/MDEAnalytics/DataTopic.jsp?TOPICID=11——使用 RSelenium。到目前为止,这是我所拥有的,它适用于下载 pdf 的第一个实例(也可以通过选择“县”级别然后单击网站上的“列表文件”选项来获得此输出):

remDr <- remote_driver$client remDr$open() 
remDr$navigate("https://public.education.mn.gov/MDEAnalytics/DataTopic.jsp?TOPICID=11") # to navigate to a page
frames <- remDr$findElements('css', "iframe")
remDr$switchToFrame(frames[[1]])
remDr$findElement(using = "id",value = "cmbCOLUMN1")$clickElement()
option <- remDr$findElement(using = 'xpath', "//*/option[@value = 'County']")
option$clickElement()
remDr$findElement(using = "id",value = "button1")$clickElement()
report_frame <- remDr$findElement(using = "id",value = "report")
remDr$switchToFrame(report_frame)
remDr$findElement(using = "class", value = "buttonpdf")$clickElement() 

如何使用 RSelenium 下载其余的 pdf? 我尝试使用 $findElements 方法并尝试使用不同的“使用”参数,但没有成功。我不太熟悉 RSelenium 和先决条件的 html/css 技能,这将有助于解决这个问题。

r selenium-webdriver rselenium
© www.soinside.com 2019 - 2024. All rights reserved.