class Playwright::ConsoleMessage
“‘
.json_value() # 42<br>msg.args.json_value() # hello
# Deconstruct print arguments
msg = msg_info.value
page.evaluate(“console.log(’hello’, 42, { foo: ‘bar’ })”)
# Issue console.log inside the page
with page.expect_console_message() as msg_info:
# Get the next console log
page.on(“console”, lambda msg: print(f“error: {msg.text}”) if msg.type == “error” else None)
# Listen for all console events and handle errors
page.on(“console”, lambda msg: print(msg.text))
# Listen for all console logs
“‘python sync
context.
For each console messages logged in the page there will be corresponding event in the Playwright
`ConsoleMessage` objects are dispatched by page via the [`event: Page.console`] event.
def args
def args wrap_impl(@impl.args) end
def location
def location wrap_impl(@impl.location) end
def page
def page wrap_impl(@impl.page) end
def text
def text wrap_impl(@impl.text) end
def type
`'trace'`, `'clear'`, `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`, `'profile'`, `'profileEnd'`,
One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`,
def type wrap_impl(@impl.type) end