feat: handle scrapeList in WAW actions

This commit is contained in:
karishmas6
2024-08-06 23:20:10 +05:30
parent a3d699b776
commit 20810aa85b

View File

@@ -291,6 +291,12 @@ export default class Interpreter extends EventEmitter {
await this.options.serializableCallback(scrapeResult);
},
scrapeList: async (config: { listSelector: string, fields: any, limit?: number, flexible?: boolean }) => {
await this.ensureScriptsLoaded(page);
const scrapeResults: Record<string, any>[] = await page.evaluate((cfg) => window.scrapeList(cfg), config);
await this.options.serializableCallback(scrapeResults);
},
scroll: async (pages?: number) => {
await page.evaluate(async (pagesInternal) => {
for (let i = 1; i <= (pagesInternal ?? 1); i += 1) {