Is it possible to autosave a web page as an image inside R?

I think this can be done, but I do not know if functionality exists. I searched the Internet stack and tall and found nothing. I would like to save www.espn.com as an image in a specific folder on my computer at a specific time of the day. Is it possible? Any help would be greatly appreciated.

+3
source share
1 answer

Selenium allows you to do this. See http://johndharrison.imtqy.com/RSelenium/ . DISCLAIMER I am the author of the RSelenium package. An image can be exported as base64 encoded png. As an example:

# RSelenium::startServer() # start a selenium server if required
require(RSelenium)
remDr <- remoteDriver()
remDr$open()
remDr$navigate("http://espn.go.com/")
# remDr$screenshot(display = TRUE) # to display image
tmp <- paste0(tempdir(), "/tmpScreenShot.png")
base64png <- remDr$screenshot()
writeBin(base64Decode(base64png, "raw"), tmp)

The png will be saved in the file specified in tmp.

RSelenium RSelenium:

0

All Articles