feat: add darkMode and hideSelectors to Node.js and Python SDKs
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Has been cancelled

This commit is contained in:
OpenClaw Dev 2026-03-04 15:07:20 +01:00
parent 96d21aa63b
commit 90c1e7da44
3 changed files with 125 additions and 0 deletions

View file

@ -33,6 +33,10 @@ export interface ScreenshotOptions {
delay?: number;
/** Page load event to wait for (default: domcontentloaded) */
waitUntil?: "load" | "domcontentloaded" | "networkidle0" | "networkidle2";
/** Emulate dark mode (prefers-color-scheme: dark) */
darkMode?: boolean;
/** CSS selectors to hide before capture (max 10, each max 200 chars) */
hideSelectors?: string | string[];
}
export interface SnapAPIConfig {
@ -108,6 +112,18 @@ export class SnapAPI {
* format: 'png',
* deviceScale: 2
* });
*
* // Dark mode with hidden elements
* const darkScreenshot = await snap.capture({
* url: 'https://example.com',
* darkMode: true,
* hideSelectors: ['.ads', '.popup', '.cookie-banner']
* });
*
* // Hide single selector
* const clean = await snap.capture('https://example.com', {
* hideSelectors: '.advertisement'
* });
* ```
*
* @throws {SnapAPIError} When the API returns an error response