1

The page at this link in the webshot command includes ovals to indicate air quality in a particular location

webshot("https://www.purpleair.com/map?&zoom=12&lat=39.09864026298141&lng=-108.56749455168722&clustersize=27&orderby=L&latr=0.22700642752714373&lngr=0.4785919189453125", "paMap.png")

The png that webshot produces doesn't include these ovals. I suspect these are created with javascript and webshot is not picking them up. But I don't know how to tell it to do so, or even if it is possible.

JerryN
  • 2,356
  • 1
  • 15
  • 49

2 Answers2

2

Although this issue is not directly related with webshot versions, you should consider to try webshot2 on https://github.com/rstudio/webshot2 instead of using webshot. I have prepared a blog post including various details about webshot2. You can see the details from here. In addition, see my detailed answer about the issues on webshot compared to webshot2.

I have replicated your scenario with webshot2 and delay parameter, the issue is resolved as below screenshot. The main issue is related with delay side. Basically, the URL needs a longer delay for all assets to display.

The code

library(webshot2)

temp_url = "https://www.purpleair.com/map?&zoom=12&lat=39.09864026298141&lng=-108.56749455168722&clustersize=27&orderby=L&latr=0.22700642752714373&lngr=0.4785919189453125"
webshot(url = temp_url, file = "paMap.png", delay = 4)

The output file enter image description here

ozturkib
  • 1,493
  • 16
  • 28
0
library(RSelenium)
remDr <- remoteDriver(remoteServerAddr = "192.168.99.100", port = 4445L)
remDr$open()
remDr$navigate("https://www.purpleair.com/map?&zoom=12&lat=39.09864026298141&lng=-108.56749455168722&clustersize=27&orderby=L&latr=0.22700642752714373&lngr=0.4785919189453125")
remDr$screenshot(file = "paMag.png")

effect:

enter image description here

mw0000
  • 59
  • 2
  • RSelenium and several of its dependencies are no longer on CRAN. I found them on GitHub and installed them, but.. see next comment. – JerryN May 13 '18 at 22:06
  • The `remDr$open` code returns Error in checkError(res) : Undefined error in httr call. httr output: Timeout was reached: Connection timed out after 10005 milliseconds. – JerryN May 13 '18 at 22:22
  • I have set up rselenium with the use of Docker and that manual: https://ropensci.github.io/RSelenium/articles/RSelenium-docker.html `$ docker pull selenium/standalone-firefox:2.53.0` `$ docker run -d -p 4445:4444 selenium/standalone-firefox:2.53.0` and after that run the R code – mw0000 May 14 '18 at 08:38
  • I'm working on a mac. I used the docker commands in a shell and they seemed to work fine. But I'm still getting the timeout error message when I run the R command `remDr$open`, both in a shell and in RStudio. Does it matter than that the standalone seems to be associated with firefox and I don't have that on my mac? My docker version is 18.03.1-ce-mac65 (24312). – JerryN May 14 '18 at 17:18
  • it may be, use the pull command `$ docker pull selenium/standalone-firefox:2.53.0` https://github.com/SeleniumHQ/docker-selenium – mw0000 May 14 '18 at 17:53
  • Isn't this the same as the pull command in the previous comment. FYI, I now have both chrome and firefox on my mac. – JerryN May 14 '18 at 18:04
  • what is a result when you sent this into terminal? `$ docker ps` – mw0000 May 14 '18 at 18:09
  • CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES – JerryN May 14 '18 at 18:37