Last active
November 18, 2021 11:51
-
-
Save inoyakaigor/19ae0eeabf93fbfc04c368ffa17b6efa to your computer and use it in GitHub Desktop.
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') | |
const { PendingXHR } = require('pending-xhr-puppeteer') | |
;( async () => { | |
const browser = await puppeteer.launch({ | |
headless: true, | |
product: 'firefox', | |
// args, | |
}) | |
const page = await browser.newPage() | |
// await page.setDefaultTimeout(120000) // to get error about "documentTitle" uncomment | |
const pendingXHR = new PendingXHR(page) | |
await page.goto(`https://twitter.com/halo/status/1289298976550731776?s=12`) | |
// Here all xhr requests are not finished | |
await pendingXHR.waitForAllXhrFinished() | |
await page.waitForSelector('article[role="article"]') | |
const element = await page.$('article[role="article"]') | |
await element.screenshot({path: 'screenshot.png'}) | |
await browser.close() | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment