Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Commit 16a8a6b

Browse files
authored
Merge pull request #5 from slorber/patch-1
fix: waiting for lazy-loaded images always timeouts
2 parents 5c784c3 + e3a9bf3 commit 16a8a6b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ function waitForFontLoading() {
3737

3838
// Check if the images are loaded
3939
function waitForImagesLoading() {
40-
return Array.from(document.images).every((img) => img.complete);
40+
const allImages = Array.from(document.images);
41+
allImages.forEach(img => img.loading = "eager")
42+
return allImages.every((img)=>img.complete);
4143
}
4244

4345
type LocatorOptions = Parameters<Page["locator"]>[1];

0 commit comments

Comments
 (0)