Skip to content

Instantly share code, notes, and snippets.

@housemeow
Created March 6, 2018 09:50
Show Gist options
  • Save housemeow/7cf702731f221d939515b7f04e5a5ce6 to your computer and use it in GitHub Desktop.
Save housemeow/7cf702731f221d939515b7f04e5a5ce6 to your computer and use it in GitHub Desktop.
let resolveDialogClosePromise;
const dialogClosePromise = new Promise(resolve => {
resolveDialogClosePromise = resolve;
});
this.page.on('dialog', async dialog => {
await dialog.accept();
resolveDialogClosePromise();
});
await Promise.all([this.page.waitForNavigation(), this.page.click('#send')]);
this.gid = this.page.url().split('gid=')[1];
console.log('gid', this.gid);
await Promise.race([dialogClosePromise, util.sleep(20000)]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment