pub struct Connection { /* private fields */ }Expand description
A protocol conversation with one Playwright driver.
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn new<R, W>(reader: R, writer: W) -> Self
pub fn new<R, W>(reader: R, writer: W) -> Self
Start a conversation over a framed byte stream (the driver’s stdout and stdin). Messages are read on a background task.
Sourcepub async fn initialize(&self) -> Result<Playwright, ProtocolError>
pub async fn initialize(&self) -> Result<Playwright, ProtocolError>
Run the initialize handshake and return the Playwright root object.
Sourcepub fn channel(&self, guid: &str) -> Channel
pub fn channel(&self, guid: &str) -> Channel
A channel for the object with guid, without checking that it exists.
Sourcepub fn object<T: ChannelType>(
&self,
reference: &Ref<T>,
) -> Result<T, ProtocolError>
pub fn object<T: ChannelType>( &self, reference: &Ref<T>, ) -> Result<T, ProtocolError>
Resolve a typed reference to the object the driver created.
Sourcepub fn object_by_guid<T: ChannelType>(
&self,
guid: &str,
) -> Result<T, ProtocolError>
pub fn object_by_guid<T: ChannelType>( &self, guid: &str, ) -> Result<T, ProtocolError>
Resolve a guid to a typed object, checking its interface.
Sourcepub fn children<T: ChannelType>(&self, parent: &str) -> Vec<T>
pub fn children<T: ChannelType>(&self, parent: &str) -> Vec<T>
The live children of parent that are Ts, in no particular order.
Sourcepub fn raw_initializer(&self, guid: &str) -> Result<Value, ProtocolError>
pub fn raw_initializer(&self, guid: &str) -> Result<Value, ProtocolError>
The raw initializer of a live object.
Sourcepub fn object_count(&self) -> usize
pub fn object_count(&self) -> usize
Number of live objects the driver has announced.
Sourcepub fn close_reason(&self) -> Option<String>
pub fn close_reason(&self) -> Option<String>
Why the connection closed, if it has.
Sourcepub fn set_default_timeout(&self, timeout_ms: Option<f64>)
pub fn set_default_timeout(&self, timeout_ms: Option<f64>)
Set the timeout, in milliseconds, sent with every call that does not name its own. The driver treats a call without one as unbounded.
Sourcepub fn default_timeout(&self) -> Option<f64>
pub fn default_timeout(&self) -> Option<f64>
The timeout sent with calls that do not name their own.
Sourcepub async fn call(
&self,
guid: &str,
method: &str,
params: Value,
) -> Result<Value, ProtocolError>
pub async fn call( &self, guid: &str, method: &str, params: Value, ) -> Result<Value, ProtocolError>
Send a raw call and wait for its raw result.
Sourcepub async fn call_with_timeout(
&self,
guid: &str,
method: &str,
params: Value,
timeout_ms: Option<f64>,
) -> Result<Value, ProtocolError>
pub async fn call_with_timeout( &self, guid: &str, method: &str, params: Value, timeout_ms: Option<f64>, ) -> Result<Value, ProtocolError>
Send a raw call with an explicit timeout in milliseconds (None waits
as long as the driver does).
Sourcepub async fn close_input(&self)
pub async fn close_input(&self)
Close the pipe to the driver. run-driver exits once its input ends;
calls made afterwards fail with ProtocolError::Closed.
Trait Implementations§
Source§impl Clone for Connection
impl Clone for Connection
Auto Trait Implementations§
impl !RefUnwindSafe for Connection
impl !UnwindSafe for Connection
impl Freeze for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnsafeUnpin for Connection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more