Skip to content

Commit

Permalink
feat: add waitForSelectorTimeout config option
Browse files Browse the repository at this point in the history
  • Loading branch information
iperzic committed Nov 17, 2023
1 parent 29fc934 commit 4c892e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ type Config = {
page: Page;
pushData: (data: any) => Promise<void>;
}) => Promise<void>;
/** Optional timeout for waiting for a selector to appear */
waitForSelectorTimeout?: number;
};

export const config: Config = {
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (process.env.NO_CRAWL !== "true") {
log.info(`Crawling ${request.loadedUrl}...`);

await page.waitForSelector(config.selector, {
timeout: 1000,
timeout: config.waitForSelectorTimeout ?? 1000,
});

const html = await getPageHtml(page);
Expand Down

0 comments on commit 4c892e6

Please sign in to comment.