Shot-scraper: automated screenshots for documentation, built on Playwright
simonwillison.net
simonwillison.net
I'm hoping people with stronger frontend skills than me will provide some more interesting examples there!
ShotScraper.annotate(
".facet-link",
ShotScraper.Arrow({
color: "pink",
width: 150,
direction: "right"
})
)
Building this out is a lot of extra work though, so I decided to ship without that and see what kind of things people needed.If there is a transparant SVG canvas placed over the element, then the positioning of elements should be relatively trivial? It would basically follow the example JavaScript in the post.
If I ship a JavaScript library with the tool, then modify that JavaScript library later, I risk breaking the automated screenshots that were scripted against previous versions of the library.
If I'm committing to shipping a library that won't break backwards compatibility, I have to be very confident that I'm designing it well from the start.
So I'm probably going to do it at some point, but I'm not going to rush into it.
Shotscraper.v1.annotate( // etcI made an automated test that would allow me to grab screenshots for documentation. Besides it's primary function as an automated Selenium test, it also provided a realistic test data and allowed me to update the screenshots as the design of my Retrospective tool took shape.