- Now supports taking screenshots of **pages that require authentication**. [18](https://github.com/simonw/shot-scraper/issues/18)
The following command will open a browser window for the specified website, wait for you to manually authenticate and hit `<enter>` in the terminal, and then write the resulting authentication context out to `auth.json`:
shot-scraper auth https://github.com/ auth.json`
You can then take authenticated screenshots like this:
shot-scraper https://github.com/notifications \
--auth auth.json -o notifications.png
The `-a/--auth` option is also supported by the `multi`, `pdf` and `accessibility` commands.
- The `shot-scraper` command can now open a browser in which you can **interact with a page** before the screenshot is taken: [31](https://github.com/simonw/shot-scraper/issues/31)
shot-scraper https://simonwillison.net/ \
-o after-interaction.png \
--height 800 --interactive
This will output:
Hit <enter> to take the shot and close the browser window:
And after you hit <enter>...
Screenshot of 'https://simonwillison.net/' written to 'after-interaction.png'
- You can now pass **multiple CSS selectors** in order to take a screenshot of the smallest area that encompasses all of the content referenced by those selectors: [21](https://github.com/simonw/shot-scraper/issues/21)
shot-scraper https://simonwillison.net/ \
-s 'bighead' -s .overband \
-o bighead-multi-selector.png
Add `--padding 20` to include an additional 20px of padding around the specified area.
The YAML format used by `snap-shotter multi` also now supports multiple CSS selectors, which look like this:
yaml
- output: bighead-multi-selector.png
url: https://simonwillison.net/
selectors:
- "bighead"
- .overband
padding: 20
- Scripted tests can now be run using `tests/run_examples.sh` [29](https://github.com/simonw/shot-scraper/issues/29)