简体   繁体   中英

Puppeteer wait for page to fully load before proceeding

Here's my code. So basically I have an element in the page that I will click. Im not sure if waitForNavigation is the correct function to use here but I want the page to load fully before proceeding on to the next step.

I could use waitForSelector as a workaround, but what if I dont have a fixed selector that I can search?

    await Promise.all([
      this.page.waitForNavigation(),
      element.click()
    ])

Use options.waitUntil ( doc )

await Promise.all([
  this.page.waitForNavigation({ waitUntil: 'networkidle2' }),
  element.click()
])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM