diff --git a/maxun-core/src/interpret.ts b/maxun-core/src/interpret.ts index ca273ac1..7c3c08d4 100644 --- a/maxun-core/src/interpret.ts +++ b/maxun-core/src/interpret.ts @@ -367,6 +367,7 @@ export default class Interpreter extends EventEmitter { private async handlePagination(page: Page, config: { listSelector: string, fields: any, limit?: number, pagination: any }) { let allResults: Record[] = []; let currentPage = 1; + let previousHeight = 0 while (true) { // Scrape current page @@ -380,7 +381,6 @@ export default class Interpreter extends EventEmitter { switch (config.pagination.type) { case 'scrollDown': - let previousHeight = 0 await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight)); // Wait for potential lazy-loaded content await page.waitForTimeout(2000);