Puppeteer: How to handle multiple tabs?

后端 未结 8 818
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-13 09:09

Scenario: Web form for developer app registration with two part workflow.

Page 1: Fill out developer app details and click on button to create Application ID, which

8条回答
  •  北海茫月
    2020-12-13 09:39

    If your click action is emitting a pageload, then any subsequent scripts being ran are effectively lost. To get around this you need to trigger the action (a click in this case) but not await for it. Instead, wait for the pageload:

    page.click('.get-appId');
    await page.waitForNavigation();
    

    This will allow your script to effectively wait for the next pageload event before proceeding with further actions.

提交回复
热议问题