Documentation
¶
Overview ¶
Command console is a chromedp example demonstrating how to read the console of a page and its uncaught exceptions with chromedp.Console. The program loads a local page that calls console.log, console.warn and console.error with strings and objects. After a click, the page throws an exception that nothing catches, rejects a promise that nothing handles, and loads an image that does not exist, which the browser reports as an error of the network. The program prints every message in order, with its type, its text, its place (URL, line and column) and the first lines of the stack trace of an exception. Then it shows how to read only some types, and how to stop reading with a break and with a canceled context. It starts a local server and needs no internet. Use -v to print the protocol messages and -visible to show the browser window and leave it open. Use -visible-on-terminal to draw the page in the terminal with terminal graphics.