Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update puppeteer #60

Merged
merged 5 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/alfa-cli/src/alfa/command/scrape/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ export const Flags = {

awaitDuration: Flag.integer(
"await-duration",
"The duration to wait before considering the page loaded."
`The duration to wait before considering the page loaded.
Note that waiting for fixed durations creates race conditions and is less
reliable than other awaiters. This flag must be used with caution, especially
in settings where reliability is important (production, automated tests, …)`
)
.type("milliseconds")
.optional(),
Expand Down
2 changes: 1 addition & 1 deletion packages/alfa-puppeteer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@siteimprove/alfa-dom": "^0.88.0",
"@siteimprove/alfa-http": "^0.88.0",
"@siteimprove/alfa-web": "^0.88.0",
"puppeteer": "^19.9.1"
"puppeteer": "^22.14.0"
},
"peerDependencies": {
"@siteimprove/alfa-device": "^0.88.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/alfa-scraper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@siteimprove/alfa-time": "^0.88.0",
"@siteimprove/alfa-url": "^0.88.0",
"@siteimprove/alfa-web": "^0.88.0",
"puppeteer": "^19.9.1"
"puppeteer": "^22.14.0"
},
"devDependencies": {
"@siteimprove/alfa-test": "^0.88.0"
Expand Down
6 changes: 4 additions & 2 deletions packages/alfa-scraper/src/awaiter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ export namespace Awaiter {
const error = await after(page, timeout);

if (error.isNone()) {
await page.waitForTimeout(duration);
await new globalThis.Promise(function (resolve) {
setTimeout(resolve, duration);
});
}

return error;
Expand Down Expand Up @@ -144,7 +146,7 @@ export namespace Awaiter {
export function xpath(expression: string): Awaiter {
return async (page, timeout) => {
try {
await page.waitForXPath(expression, {
await page.waitForSelector("xpath/" + expression, {
timeout: timeout.remaining(),
});

Expand Down
Loading