Skip to content

Commit

Permalink
chore: fix timeouts for waitForSelector in playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
B4nan committed Jun 6, 2024
1 parent 6f88e73 commit 53ce1d3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/jsdom-crawler/src/internals/jsdom-crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export interface JSDOMCrawlingContext<
document: Document;

/**
* Wait for an element matching the selector to appear. Timeout is ignored.
* Wait for an element matching the selector to appear.
* Timeout defaults to 5s.
*
* **Example usage:**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export interface LinkeDOMCrawlingContext<
document: Document;

/**
* Wait for an element matching the selector to appear. Timeout is ignored.
* Wait for an element matching the selector to appear.
* Timeout defaults to 5s.
*
* **Example usage:**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -827,11 +827,11 @@ export function registerUtilsToContext(
await injectJQuery(context.page, { surviveNavigations: false });
};
context.blockRequests = async (options?: BlockRequestsOptions) => blockRequests(context.page, options);
context.waitForSelector = async (selector: string, timeoutMs?: number) => {
context.waitForSelector = async (selector: string, timeoutMs = 5_000) => {
const locator = context.page.locator(selector).first();
await locator.waitFor({ timeout: timeoutMs, state: 'attached' });
};
context.parseWithCheerio = async (selector?: string, timeoutMs?: number) => {
context.parseWithCheerio = async (selector?: string, timeoutMs = 5_000) => {
if (selector) {
await context.waitForSelector(selector, timeoutMs);
}
Expand Down

0 comments on commit 53ce1d3

Please sign in to comment.