Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# Console

This domain is deprecated - use Runtime or Log instead.

- Types

- Commands

- Events

## Types

Generally, you do not need to instantiate CDP types yourself. Instead, the API creates objects for you as return values from commands, and then you can use those objects as arguments to other commands.

class ConsoleMessage(source, level, text, url=None, line=None, column=None)

  Console message.

  source: `str`

    Message source.

  level: `str`

    Message severity.

  text: `str`

    Message text.

  url: `Optional`[`str`] = None

    URL of the message origin.

  line: `Optional`[`int`] = None

    Line number in the resource that generated this message (1-based).

  column: `Optional`[`int`] = None

    Column number in the resource that generated this message (1-based).

## Commands

Each command is a generator function. The return type `Generator[x, y, z]` indicates that the generator yields arguments of type `x`, it must be resumed with an argument of type `y`, and it returns type `z`. In this library, types `x` and `y` are the same for all commands, and `z` is the return type you should pay attention to. For more information, see Getting Started: Commands.

clear_messages()

  Does nothing.

  Return type:

    `Generator`[`Dict`[`str`, `Any`], `Dict`[`str`, `Any`], `None`]

disable()

  Disables console domain, prevents further console messages from being reported to the client.

  Return type:

    `Generator`[`Dict`[`str`, `Any`], `Dict`[`str`, `Any`], `None`]

enable()

  Enables console domain, sends the messages collected so far to the client by means of the `messageAdded` notification.

  Return type:

    `Generator`[`Dict`[`str`, `Any`], `Dict`[`str`, `Any`], `None`]

## Events

Generally, you do not need to instantiate CDP events yourself. Instead, the API creates events for you and then you use the event’s attributes.

class MessageAdded(message)

  Issued when new console message is added.

  message: `ConsoleMessage`

    Console message that has been added.