mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Fallback to body if documentElement not available
This commit is contained in:
@@ -131,7 +131,15 @@ export class UrlContentFetcher {
|
|||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
|
|
||||||
// image cannot exceed 8_000 pixels
|
// image cannot exceed 8_000 pixels
|
||||||
const pageHeight = await this.page.evaluate(() => document.documentElement.scrollHeight)
|
const { pageHeight, pageWidth } = await this.page.evaluate(() => {
|
||||||
|
const html: HTMLElement | null = document.documentElement
|
||||||
|
const body: HTMLElement | null = document.body
|
||||||
|
return {
|
||||||
|
pageHeight: html?.scrollHeight || body?.scrollHeight,
|
||||||
|
pageWidth: html?.clientWidth || body?.clientWidth,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// const defaultViewport = this.page.viewport(); // width 800 height 600 by default
|
||||||
let options: ScreenshotOptions = {
|
let options: ScreenshotOptions = {
|
||||||
// fullPage: true, // clip and fullPage are mutually exclusive
|
// fullPage: true, // clip and fullPage are mutually exclusive
|
||||||
encoding: "base64",
|
encoding: "base64",
|
||||||
@@ -139,7 +147,7 @@ export class UrlContentFetcher {
|
|||||||
clip: {
|
clip: {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
width: await this.page.evaluate(() => document.documentElement.clientWidth),
|
width: pageWidth,
|
||||||
height: Math.min(pageHeight, 8_000),
|
height: Math.min(pageHeight, 8_000),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user