Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Update example waitforfunction to await
Browse files Browse the repository at this point in the history
  • Loading branch information
inancgumus committed Sep 30, 2024
1 parent a6e8f78 commit cc34feb
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions examples/waitforfunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ export default async function() {
}, 1000);
});

await check(page, {
'waitForFunction successfully resolved':
p => p.waitForFunction(
"document.querySelector('h1')", {
polling: 'mutation',
timeout: 2000
})
.then(e => e.innerHTML())
.then(text => text == 'Hello')
const e = await page.waitForFunction(
"document.querySelector('h1')", {
polling: 'mutation',
timeout: 2000
}
);
await check(e, {
'waitForFunction successfully resolved': async e => {
return await e.innerHTML() === 'Hello';
}
});
} finally {
await page.close();
Expand Down

0 comments on commit cc34feb

Please # to comment.