supapup
Version:
⚡ Lightning-fast MCP browser dev tool. Navigate → Get instant structured data. No screenshots needed! Puppeteer: 📸 → CSS selectors → JS eval. Supapup: semantic IDs ready to use. 10x faster, 90% fewer tokens.
62 lines • 1.8 kB
TypeScript
/**
* PageSettleDetector - Robust page settlement detection for Puppeteer
*
* Combines multiple signals to determine when a page has truly settled after an action:
* - DOM mutations (debounced)
* - Network activity
* - Loading indicators
* - Navigation detection
* - Dialog handling
*/
import { Page } from 'puppeteer';
export interface SettleOptions {
domIdleTime?: number;
networkIdleTime?: number;
globalTimeout?: number;
waitForSelector?: string;
waitForFunction?: string;
ignoredSelectors?: string[];
ignoredAttributes?: string[];
}
export interface SettleResult {
settled: boolean;
hasChanges: boolean;
navigated: boolean;
dialogHandled: boolean;
error?: Error;
changes: {
domMutations: boolean;
networkActivity: boolean;
newElements: number;
removedElements: number;
urlChanged: boolean;
dialogType?: 'alert' | 'confirm' | 'prompt';
};
duration: number;
}
export declare class PageSettleDetector {
private page;
private startTime;
constructor(page: Page);
/**
* Wait for the page to settle after an action
* Sets up all observers BEFORE the action is executed
*/
waitForPageSettle(options?: SettleOptions): Promise<SettleResult>;
/**
* Wait for common loading indicators to disappear
*/
private waitForLoadingIndicators;
/**
* Set up dialog handling (alert, confirm, prompt)
*/
private setupDialogHandling;
/**
* Utility method to perform action and wait for settlement
*/
performActionAndWaitForSettle(action: () => Promise<any>, options?: SettleOptions): Promise<{
actionResult: any;
settleResult: SettleResult;
}>;
}
//# sourceMappingURL=page-settle-detector.d.ts.map