我正在尝试使用RSelenium打开本地HTML文件。
我一直在遵循本指南(https://callumgwtaylor.github.io/blog/2018/02/01/using-rselenium-and-docker-to-webscrape-in-r-using-the-who-snake-database/),除了将URL替换为本地路径时,其他所有操作似乎都没有问题。我尝试将路径转换为同样失败的链接。
file:///C:/Users/Username/Desktop/file.html.
该html文件包含需要抓取的报告中的数据,原始文件实际上不在网络上。我对抓取数据还很陌生,因此可以提供任何帮助。
library(RSelenium)
library(rvest)
library(xml2)
library(tidyverse)
remDr <- RSelenium::remoteDriver(remoteServerAddr = "localhost",
port = 4445L,
browserName = "chrome")
remDr$open()
remDr$navigate("http://apps.who.int/bloodproducts/snakeantivenoms/database/SearchFrm.aspx") #Entering our URL gets the browser to navigate to the page
remDr$screenshot(display = TRUE) #This will take a screenshot and display it in the RStudio viewer