fix: set 1920x1080 @2x viewport before capture

Wide tables (商品件重尺) were getting cut off at the right edge.
Now emulates a 1920x1080 PC viewport at 2x scale before navigating,
ensuring all columns fit in screenshots.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ywkj 2026-03-30 13:48:00 +08:00
parent 92a3e2eba3
commit 93517505d4
1 changed files with 9 additions and 0 deletions

View File

@ -191,6 +191,15 @@ export async function run(
await cdp.send('Page.enable');
await cdp.send('Runtime.enable');
// Set wide PC viewport to ensure tables fit without horizontal overflow
await cdp.send('Emulation.setDeviceMetricsOverride', {
width: 1920,
height: 1080,
deviceScaleFactor: 2,
mobile: false,
});
await cdp.send('Page.navigate', { url });
// Wait for page load + dynamic content