I am trying to write a set of R codes to take screenshots from a password-protected website.
I have tried using the webshot
and httr
packages but could not figure out a solution for this.
Below are the codes that I have tried.
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")
The screenshot shows the login page instead of the page that I want to screenshot. Which means that the website has not been logged in yet before the screenshot is taken. Can anyone help me?