我正在尝试编写一组R代码,以便从一个受密码保护的网站截图。我尝试过使用webshot和httr包,但找不到解决方案。下面是我尝试过的代码。
library(httr)
library(webshot)
handle <- handle("url of the home page")
path <- "url of login page"
login <- list(username = "my username", password = "my password", redirect_url = "url of the page that I want to screenshot")
response <- POST(handle = handle, path = path, body = login)
webshot("url of the page that I want to screenshot", "screenshot.png")屏幕截图显示的是登录页面,而不是我要截图的页面。这意味着在截图之前网站还没有登录。有谁可以帮我?
发布于 2021-10-22 19:44:45
使用RSelenium包可以很容易地做到这一点。这允许你填写用户名和密码,还具有屏幕截图功能,可以截取网页并将其保存到磁盘。
https://stackoverflow.com/questions/69534594
复制相似问题