library(chromote)
Sys.setenv(CHROMOTE_CHROME="/usr/bin/chromium")
b <- ChromoteSession$new()
b$Page$navigate("https://www.instagram.com/")
#> $frameId
#> [1] "7A4B060856C628A9F30A449F9F443F42"
#>
#> $loaderId
#> [1] "40A73E0B9E658A449DFFC5531064C3E2"
p <- b$DOM$getDocument(wait_ = FALSE) %...>%
{ b$DOM$querySelector(.$root$nodeId, "article", wait_ = FALSE) } %...>%
{ b$DOM$getBoxModel(.$nodeId, wait_ = FALSE) }
b$wait_for(p)
#> Error in onRejected(...): code: -32000
#> message: Could not find node with given id
screenshot_tmp <- tempfile(fileext = ".png")
b$screenshot(filename = screenshot_tmp)
#> [1] "/tmp/RtmpuUjhPz/file12fa6c6af649.png"
knitr::include_graphics(screenshot_tmp)
Created on 2020-03-01 by the reprex package (v0.3.0)