我想console.log()
用WebSocket制作的request
和response
。
const browser = await puppeteer.launch({
headless: false,
args: [
'--incognito',
'--enable-features=NetworkService'
]
});
...
await page.on('console', msg => {
console.log(msg);
}
});
...
await page.setRequestInterception(true);
page.on('request', request => {
console.log('Intercepting Request ', request, { depth: null });
request.continue();
});
page.on('response', response => {
console.log('Intercepting Response ', response, { depth: null });
});
尽管已创建request
,但它不记录response
。它也不会记录 page.on('response', response => {
console.log('Intercepting Response ', response, { depth: null });
response.continue();
});
。但是,当我添加
response
向它记录class BasicLayoutActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_basic_layout)
setSupportActionBar(toolbar)
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
super.onCreateOptionsMenu(menu)
menuInflater.inflate(R.menu.menu_basic_layout,menu)
return true
}
}
。但后来我得到
(节点:15634)UnhandledPromiseRejectionWarning:TypeError:response.continue不是函数
这是怎么回事?