rstudio / webshot2

Take screenshots of web pages from R

Home Page:https://rstudio.github.io/webshot2/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support authenticated sites

blairj09 opened this issue · comments

webshot() should support screenshots of authenticated sites. A potential workflow could follow the pattern of token_fetch() from the gargle package:

  1. webshot("auth.website.url") detects that there’s an authentication layer in place (not sure if this is possible, but most auth sites will redirect to a login page if credentials are missing, so maybe check for that re-direct)
  2. Offers to cache cookies
  3. Opens a browser for the user to perform sign-in
  4. Captures and optionally caches cookies
  5. Continues on with capturing the screenshot

It may also be helpful to provide a cookies argument to webshot() so that authenticated sites can be accessed programmatically.

I miss the eval argument that webshot::webshot() has (and that I used to authenticate).

@maelle Can you file a new issue about eval?

Is there a way to use webshot with pages that require authentication now?

Just noting that you can do screenshots with chromote https://github.com/rstudio/chromote whose interface lets you perform actions on the page more easily.

Thanks @maelle. I had not heard about chromote. Great tool.