simonw / shot-scraper

A command-line utility for taking automated screenshots of websites
https://shot-scraper.datasette.io
Apache License 2.0
1.57k stars 70 forks source link

interactive mode doesn't respect viewport size for initial window #127

Closed mhalle closed 5 months ago

mhalle commented 8 months ago

The width and height parameters for setting viewport size don't set the initial window size in interactive mode (though they are later used to set the viewport before the shot).

This fact makes interactive mode less useful because the playwright browser doesn't seem responsive to interactive window resizing. The initial size of the window is thus important.

Seems like calling page.set_viewport_size() after the interactive window is launched should work.

simonw commented 5 months ago

Fixed in:

simonw commented 5 months ago

Before this fix:

shot-scraper https://simonwillison.net/ --interactive -h 700 -w 300

The interactive window ignored those options:

CleanShot 2024-02-05 at 14 41 00@2x

After this fix:

CleanShot 2024-02-05 at 14 42 22@2x