Skip to content

Commit 11c53c8

Browse files
committed
take full screen and wait for 1 second to let the screen shot success
1 parent 843415d commit 11c53c8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

frontend/src/app/api/screenshot/route.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ export async function GET(req: Request) {
3939

4040
// Set viewport to a reasonable size
4141
await page.setViewport({
42-
width: 1280,
43-
height: 720,
42+
width: 1920,
43+
height: 1080,
4444
});
4545

4646
// Navigate to URL with increased timeout and more reliable wait condition
@@ -49,10 +49,12 @@ export async function GET(req: Request) {
4949
timeout: 60000, // Increased timeout to 60 seconds
5050
});
5151

52+
await new Promise((resolve) => setTimeout(resolve, 1000)); // Waits for 1 seconds
53+
5254
// Take screenshot
5355
const screenshot = await page.screenshot({
5456
type: 'png',
55-
fullPage: false,
57+
fullPage: true,
5658
});
5759

5860
// Always close the page when done

0 commit comments

Comments
 (0)