Created
March 6, 2018 09:50
-
-
Save housemeow/7cf702731f221d939515b7f04e5a5ce6 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
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