Skip to content

Commit 5e038e5

Browse files
committed
add a timeout for waitforfunction
1 parent 0b24a3c commit 5e038e5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

playwright/cdp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ for (var run = 0; run<runs; run++) {
4949
await page.waitForFunction(() => {
5050
const price = document.querySelector('#product-price');
5151
return price.textContent.length > 0;
52-
});
52+
}, {}, {timeout: 100}); // timeout 100ms
5353

5454

5555
// ensure the reviews are loaded.
5656
await page.waitForFunction(() => {
5757
const reviews = document.querySelectorAll('#product-reviews > div');
5858
return reviews.length > 0;
59-
});
59+
}, {}, {timeout: 100}); // timeout 100ms
6060

6161
let res = {};
6262

puppeteer/cdp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ let metrics = [];
5454
await page.waitForFunction(() => {
5555
const price = document.querySelector('#product-price');
5656
return price.textContent.length > 0;
57-
});
57+
}, {timeout: 100}); // timeout 100ms
5858

5959

6060
// ensure the reviews are loaded.
6161
await page.waitForFunction(() => {
6262
const reviews = document.querySelectorAll('#product-reviews > div');
6363
return reviews.length > 0;
64-
});
64+
}, {timeout: 100}); // timeout 100ms
6565

6666
let res = {};
6767

0 commit comments

Comments
 (0)