miyakogi / pyppeteer

Headless chrome/chromium automation library (unofficial port of puppeteer)
Other
3.56k stars 372 forks source link

Handle global context errors (i.e. with no callback id) #286

Open dmaone opened 4 years ago

dmaone commented 4 years ago

Those global errors arise from, for example, invalid JSON supplied to evaluateHandle().

Current pyppeteer revision just waits forever when that happens, because error happens on CDP level, not on callback level.

While it is possible to recover from such situation, it's somewhat hard to know what command caused the error. This patch just aborts all in-flight callbacks - which works for me but may not be the optimal way to handle such errors.