Console Domain
Console domain defines methods and events for interaction with the JavaScript console. Console collects messages created by means of the JavaScript Console API. One needs to enable this domain using enable
command in order to start receiving the console messages. Browser collects messages issued while console domain is not enabled as well and reports them using messageAdded
notification upon enabling.
Methods
enable#
Enables console domain, sends the messages collected so far to the client by means of the messageAdded
notification.
disable#
Disables console domain, prevents further console messages from being reported to the client.
clearMessages#
Clears console messages collected in the browser.
Events
messageAdded#
Issued when new console message is added.
Parameters
- message
- ConsoleMessage Console message that has been added.
messageRepeatCountUpdated#
Is not issued. Will be gone in the future versions of the protocol.
Parameters
- count
- integer New repeat count value.
- timestamp
- Timestamp Timestamp of most recent message in batch.
messagesCleared#
Issued when console is cleared. This happens either upon clearMessages
command or after page navigation.
Types
ConsoleMessage#
Console message.
Type: object
Properties
- source
- string Message source. Allowed values: xml, javascript, network, console-api, storage, appcache, rendering, security, other, deprecation.
- level
- string Message severity. Allowed values: log, warning, error, debug, info, revokedError.
- text
- string Message text.
- type
- string Console message type. Allowed values: log, dir, dirxml, table, trace, clear, startGroup, startGroupCollapsed, endGroup, assert, profile, profileEnd.
- scriptId
- string Script ID of the message origin.
- url
- string URL of the message origin.
- line
- integer Line number in the resource that generated this message.
- column
- integer Column number in the resource that generated this message.
- repeatCount
- integer Repeat count for repeated messages.
- parameters
- array [ Runtime.RemoteObject ] Message parameters in case of the formatted message.
- stackTrace
- StackTrace JavaScript stack trace for assertions and error messages.
- asyncStackTrace
- AsyncStackTrace Asynchronous JavaScript stack trace that preceded this message, if available.
- networkRequestId
- Network.RequestId Identifier of the network request associated with this message.
- timestamp
- Timestamp Timestamp, when this message was fired.
- executionContextId
- Runtime.ExecutionContextId Identifier of the context where this message was created
- messageId
- integer Message id.
- relatedMessageId
- integer Related message id.
CallFrame#
Stack entry for console errors and assertions.
Type: object
Properties
- functionName
- string JavaScript function name.
- scriptId
- string JavaScript script id.
- url
- string JavaScript script name or url.
- lineNumber
- integer JavaScript script line number.
- columnNumber
- integer JavaScript script column number.
AsyncStackTrace#
Asynchronous JavaScript call stack.
Type: object
Properties
- callFrames
- array [ CallFrame ] Call frames of the stack trace.
- description
- string String label of this stack trace. For async traces this may be a name of the function that initiated the async call.
- asyncStackTrace
- AsyncStackTrace Next asynchronous stack trace, if any.