Skip to content

Instantly share code, notes, and snippets.

@IAMOTZ
Created February 23, 2021 19:05
Show Gist options
  • Save IAMOTZ/31c2b9c1d3e272653d491aa44212a316 to your computer and use it in GitHub Desktop.
Save IAMOTZ/31c2b9c1d3e272653d491aa44212a316 to your computer and use it in GitHub Desktop.
Puppeteer: Wait for element to not be in the DOM
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