You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to automate creating screenshots for documentation, but I have an issue with getting the right resolution. Below are two screenshots of the same playwright-cli open --headed https://en.wikipedia.org/wiki/Main_Page session:
Created with macOS screenshot shortcut:
Created with playwright-cli screenshot e362:
As you can see the macOS screenshot is higher quality, in fact it is double the resolution.
I find no way of controlling the resolution of screenshots with playwright-cli, is it possible?
Activity
markusjohnsson commentedon Apr 30, 2026
I've tried using a config file with
deviceScaleFactor:{ "browser": { "contextOptions": { "viewport": { "width": 1280, "height": 720 }, "deviceScaleFactor": 2 } } }But I still get low res screenshots.
I'd like to make the equivalent call of
screenshot({ "scale": "device" }). Can I write my own script that connects the the playwright-cli browser?markusjohnsson commentedon Apr 30, 2026
OK, so after my last comment I found the
run-codecommand and I now have this, that actually produces a high res screenhot:BUT, I'd like to be able to use a
<ref>to run for just one element, not the whole page, is that possible?EDIT:
I have a working solution for now: