UNPKG

stepwright

Version:

A powerful web scraping library built with Playwright

51 lines 1.76 kB
export type SelectorType = 'id' | 'class' | 'tag' | 'xpath'; export type DataType = 'text' | 'html' | 'value' | 'default'; export interface BaseStep { id: string; description?: string; object_type?: SelectorType; object?: string; action: 'navigate' | 'input' | 'click' | 'data' | 'scroll' | 'download' | 'foreach' | 'open' | 'savePDF' | 'printToPDF'; value?: string; key?: string; data_type?: DataType; wait?: number; terminateonerror?: boolean; subSteps?: BaseStep[]; } export interface PaginationConfig { /** Strategy to move between pages */ strategy: 'next' | 'scroll'; /** For strategy='next' */ nextButton?: { object_type: SelectorType; object: string; wait?: number; }; /** For strategy='scroll' */ scroll?: { offset?: number; delay?: number; }; /** Maximum number of pages/scroll iterations to perform (safety guard). Omit for unlimited */ maxPages?: number; paginationFirst?: boolean; paginateAllFirst?: boolean; } export interface TabTemplate { tab: string; /** Steps executed ONCE before pagination loop (e.g., perform initial search) */ initSteps?: BaseStep[]; /** Steps executed for EVERY page/scroll iteration (including first). */ perPageSteps?: BaseStep[]; /** Legacy single steps array (deprecated) */ steps?: BaseStep[]; /** Optional pagination instructions for this tab */ pagination?: PaginationConfig; } export interface RunOptions { browser?: import('playwright').LaunchOptions; /** Callback function to receive results as they're processed */ onResult?: (result: Record<string, any>, index: number) => void | Promise<void>; } //# sourceMappingURL=types.d.ts.map