From ab073990177eb7ce7007b932dfb90b6e70801560 Mon Sep 17 00:00:00 2001 From: RohitR311 Date: Sat, 11 Jan 2025 17:56:17 +0530 Subject: [PATCH] feat: rm selector from array if not visible --- maxun-core/src/interpret.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maxun-core/src/interpret.ts b/maxun-core/src/interpret.ts index e385a138..b231b03b 100644 --- a/maxun-core/src/interpret.ts +++ b/maxun-core/src/interpret.ts @@ -698,6 +698,10 @@ export default class Interpreter extends EventEmitter { allResults = allResults.concat(finalResults); return allResults; } + + const selectorIndex = availableSelectors.indexOf(workingSelector!); + availableSelectors = availableSelectors.slice(selectorIndex); + // Click the 'Load More' button to load additional items try { await loadMoreButton.click(); @@ -719,6 +723,8 @@ export default class Interpreter extends EventEmitter { return allResults; } previousHeight = currentHeight; + + console.log("Results so far:", allResults.length); if (config.limit && allResults.length >= config.limit) { // If limit is set and reached, return the limited results allResults = allResults.slice(0, config.limit);