page.screenshot is extremely low resolution with a large viewport
Describe the bug
Running browser tests with playwright and viewport: { width: 1280, height: 800 }
This is unusable, the page is taller than 800px so everything else gets cropped off:
await page.viewport(600, 800)
await page.screenshot()
This captures the full page but #6512 scales it down to only 42px wide when the scrollHeight is 9300:
await page.viewport(600, document.body.scrollHeight)
await page.screenshot()
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-tszdoqkx
System Info
System:
OS: Linux 6.17 Ubuntu 25.10 25.10 (Questing Quokka)
CPU: (16) x64 AMD Ryzen 7 5700X3D 8-Core Processor
Memory: 9.52 GB / 31.27 GB
Container: Yes
Shell: 4.0.6 - /usr/bin/fish
Binaries:
Node: 24.11.1 - /run/user/1000/fnm_multishells/437459_1764264127836/bin/node
npm: 11.6.2 - /run/user/1000/fnm_multishells/437459_1764264127836/bin/npm
pnpm: 10.23.0 - /run/user/1000/fnm_multishells/437459_1764264127836/bin/pnpm
Browsers:
Chrome: 142.0.7444.175
Firefox: 145.0.1
Firefox Developer Edition: 145.0.1
Used Package Manager
pnpm
Validations
- [x] Follow our Code of Conduct
- [x] Read the Contributing Guidelines.
- [x] Read the docs.
- [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [x] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [x] The provided reproduction is a minimal reproducible example of the bug.
I've got a similar issue, but attempting to get a screenshot of a specific element (a custom component) within the iFrame. The iFrame and the Element have dimensions of 1920x1080 (just something so the zoom takes affect). The Vitest UI shows a calculated zoom of 28%. The screenshot dimensions are 547x308 and not the desired full fidelity screenshot.
Maybe the screenshot code needs to unset any zoom before capturing?
Also encountering this issue