feat: pass scrapeList to ensureScriptsLoaded

This commit is contained in:
karishmas6
2024-08-06 23:15:12 +05:30
parent 9c6f21ce91
commit ffa992f186

View File

@@ -29,6 +29,7 @@ interface InterpreterOptions {
}> }>
} }
/** /**
* Class for running the Smart Workflows. * Class for running the Smart Workflows.
*/ */
@@ -410,7 +411,7 @@ export default class Interpreter extends EventEmitter {
} }
private async ensureScriptsLoaded(page: Page) { private async ensureScriptsLoaded(page: Page) {
const isScriptLoaded = await page.evaluate(() => typeof window.scrape === 'function' && typeof window.scrapeSchema === 'function'); const isScriptLoaded = await page.evaluate(() => typeof window.scrape === 'function' && typeof window.scrapeSchema === 'function' && typeof window.scrapeList === 'function');
if (!isScriptLoaded) { if (!isScriptLoaded) {
await page.addInitScript({ path: path.join(__dirname, 'browserSide', 'scraper.js') }); await page.addInitScript({ path: path.join(__dirname, 'browserSide', 'scraper.js') });
} }