Created
February 23, 2021 19:05
-
-
Save IAMOTZ/31c2b9c1d3e272653d491aa44212a316 to your computer and use it in GitHub Desktop.
Puppeteer: Wait for element to not be in the DOM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require('puppeteer'); | |
(async () => { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
const elementSelector = 'div.some-class'; | |
await page.waitForFunction(selector => !elem, {}, elementSelector); | |
// Now, the element is not more in the DOM | |
await browser.close(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment