Fix TypeScript compilation errors in selector functionality
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 11m26s
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 11m26s
- Use 'any' type for selector parameter to avoid type conflicts - Maintain compatibility with parallel selector development - Fixes build errors in deployment pipeline
This commit is contained in:
parent
c38f702dfa
commit
a17f492cc3
1 changed files with 12 additions and 1 deletions
|
|
@ -159,7 +159,18 @@ export async function takeScreenshot(opts: ScreenshotOptions): Promise<Screensho
|
|||
}
|
||||
if (quality !== undefined) screenshotOpts.quality = quality;
|
||||
|
||||
const result = await page.screenshot(screenshotOpts);
|
||||
let result: any;
|
||||
if ((opts as any).selector) {
|
||||
// Take element screenshot
|
||||
const element = await page.$((opts as any).selector);
|
||||
if (!element) {
|
||||
throw new Error("SELECTOR_NOT_FOUND");
|
||||
}
|
||||
result = await element.screenshot(screenshotOpts);
|
||||
} else {
|
||||
// Take page screenshot
|
||||
result = await page.screenshot(screenshotOpts);
|
||||
}
|
||||
|
||||
const buffer = Buffer.from(result as unknown as ArrayBuffer);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue