unconf18 icon indicating copy to clipboard operation
unconf18 copied to clipboard

Screenshot tools in R

Open maelle opened this issue 7 years ago • 6 comments

I've recently discovered that RSelenium and seleniumPipes offer screenshot capabilities, including the use of CSS selectors. Their syntax might be easier to use than webshot when one needs to perform an action on the webpage before taking the screenshot. 📸

I think it could be useful to

  • assess and compare the screenshot functionalities of these three packages 📄

  • design a new function or package using them that'd make screenshots even easier. 🔧

A good tool for screenshots would:

  • be well documented

  • have all arguments webshot has (CSS selection, cliprect, expand, etc.)

  • but would support not using JavaScript but instead the more "intuitive" commands one use in e.g. seleniumPipes

  • would support different browsers

  • cover both websites and Shiny apps like these three packages do

  • would use magick for image processing and would return a magick object instead of writing the screenshot to disk (or would at least offer this possibility).

A bonus would be to also cover screencasts, cf rDVR. 🎥

maelle avatar Mar 08 '18 14:03 maelle

I don't have a ton of experience in this space, but the impression I have is Selenium is being phased out in favor of webdriver, which works across multiple browsers.

There is a long standing open issue https://github.com/wch/webshot/issues/2 about improving the interaction, maybe this project could work on a PR to provide a similar interface from seleniumPipes in webshot.

jimhester avatar Apr 25 '18 12:04 jimhester

Ah cool, and I like that issue text 😀

maelle avatar Apr 25 '18 12:04 maelle

@wch before I summarize or close this, in theory would you be interested in a PR for the issue mentioned above? And could it be done independently of https://github.com/wch/webshot/issues/62#issuecomment-387785132 ? Probably not?

maelle avatar May 14 '18 18:05 maelle

@maelle I would consider a PR, but I personally don't think that it's a good place to put time and effort.

Webshot uses CasperJS, and any interaction code would likely be built on CasperJS. CasperJS is a library specifically for PhantomJS, which in turn is no longer being developed.

As @jimhester mentioned, the webdriver package is a better way to do interaction. (The reason that webshot doesn't use webdriver is that webdriver has several dependencies, and there are some applications where webshot is used it's important to have few dependencies.)

wch avatar May 15 '18 18:05 wch

Thanks!

maelle avatar May 15 '18 19:05 maelle

Summary: build a package based on webdriver to produce screenshots of websites and Shiny apps for documentation/presentation purposes.

maelle avatar May 18 '18 06:05 maelle