提交 a9bc70eb 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

listen on event load only after we are ready

上级 a5c28b8a
......@@ -173,7 +173,6 @@ export class Bridge extends EventEmitter {
const page = this.page = await browser.newPage()
page.on('error', e => this.emit('error', e))
page.on('load', () => this.emit('load', page))
page.on('dialog', this.onDialog.bind(this))
......@@ -189,6 +188,7 @@ export class Bridge extends EventEmitter {
log.silly('PuppetWebBridge', 'initPage() page.setCookie() %s cookies set back', cookieList.length)
}
page.on('load', () => this.emit('load', page))
await page.reload() // reload page to make effect of the new cookie.
return page
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册