Skip to content

Commit

Permalink
#230, The polling request on wx.qq.com prevents the page.goto() from …
Browse files Browse the repository at this point in the history
…reaching the load state, because there is a continuous polling request to the server. Therefore, we need to modify the wait state when navigating to the page.
  • Loading branch information
zinsserzc committed Dec 26, 2024
1 parent 09fedb1 commit 9e4df4f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,10 @@ export class Bridge extends EventEmitter {
// set timeout 60000 ms,30000ms always timeout
page.setDefaultTimeout(60000)
// Does this related to(?) the CI Error: exception: Navigation Timeout Exceeded: 30000ms exceeded
await page.goto(url)
await page.goto(url, {
//The polling request on wx.qq.com prevents the page.goto() from reaching the 'load' state, so we use networkidle2 to wait for the page to be fully loaded.
waitUntil: 'networkidle2',
})
log.verbose('PuppetWeChatBridge', 'initPage() after page.goto(url)')

// await this.uosPatch(page)
Expand All @@ -263,7 +266,9 @@ export class Bridge extends EventEmitter {
log.silly('PuppetWeChatBridge', 'initPage() page.setCookie() %s cookies set back', cookieList.length)
}

page.on('load', () => this.emit('load', page))
//page.on('load', () => this.emit('load', page))
//due to polling request on wx.qq.com
page.on('domcontentloaded', () => this.emit('load', page))
await page.reload() // reload page to make effect of the new cookie.

return page
Expand Down

0 comments on commit 9e4df4f

Please sign in to comment.