playwright/api/
console_message.rs1use crate::{
2 api::JsHandle,
3 imp::{console_message::ConsoleMessage as Impl, core::*, prelude::*, utils::SourceLocation}
4};
5
6#[derive(Clone)]
8pub struct ConsoleMessage {
9 inner: Weak<Impl>
10}
11
12impl ConsoleMessage {
13 pub(crate) fn new(inner: Weak<Impl>) -> Self { Self { inner } }
14
15 pub fn r#type(&self) -> Result<String, Error> { Ok(upgrade(&self.inner)?.r#type().into()) }
19
20 pub fn text(&self) -> Result<String, Error> { Ok(upgrade(&self.inner)?.text().into()) }
22
23 pub fn location(&self) -> Result<SourceLocation, Error> {
25 Ok(upgrade(&self.inner)?.location().to_owned())
26 }
27
28 pub fn args(&self) -> Result<Vec<JsHandle>, Error> {
30 Ok(upgrade(&self.inner)?
31 .args()
32 .iter()
33 .map(|x| JsHandle::new(x.clone()))
34 .collect())
35 }
36}