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

log innerHTML when onLogin not ready

上级 5b398de7
......@@ -681,14 +681,19 @@ export class Bridge extends EventEmitter {
return Misc.unescapeHtml(matches[1])
}
public async innerHTML(): Promise<string> {
const html = await this.evaluate(() => {
return document.body.innerHTML
})
return html
}
/**
* Throw if there's a blocked message
*/
public async testBlockedMessage(text?: string): Promise<string | false> {
if (!text) {
text = await this.evaluate(() => {
return document.body.innerHTML
})
text = await this.innerHTML()
}
if (!text) {
throw new Error('testBlockedMessage() no text found!')
......
......@@ -126,7 +126,9 @@ async function onLogin(this: PuppetWeb, memo: string, ttl = 30): Promise<void> {
this.userId = await this.bridge.getUserName()
if (!this.userId) {
log.verbose('PuppetWebEvent', 'onLogin: browser not fully loaded(ttl=%d), retry later', ttl)
log.verbose('PuppetWebEvent', 'onLogin() browser not fully loaded(ttl=%d), retry later', ttl)
const html = this.bridge.innerHTML()
log.silly('PuppetWebEvent', 'onLogin() innerHTML: %s', html)
setTimeout(onLogin.bind(this, memo, ttl - 1), TTL_WAIT_MILLISECONDS)
return
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册