pub struct ShadowRoot { /* private fields */ }Available on crate feature
camoufox only.Expand description
一个 open shadow root 句柄(shadow 内的查找上下文)。克隆代价低(共享 Tab 内核)。
Implementations§
Source§impl ShadowRoot
impl ShadowRoot
Sourcepub async fn ele(&self, selector: &str) -> Result<Element>
pub async fn ele(&self, selector: &str) -> Result<Element>
在 shadow 内查找单个元素(CSS 系定位);找不到返回 Error::ElementNotFound。
Sourcepub async fn eles(&self, selector: &str) -> Result<Vec<Element>>
pub async fn eles(&self, selector: &str) -> Result<Vec<Element>>
在 shadow 内查找多个元素(CSS 系定位;立即返回,不等待)。
Sourcepub async fn run_js(&self, body: &str) -> Result<Value>
pub async fn run_js(&self, body: &str) -> Result<Value>
在该 shadow root 上执行 JS(函数体内 root 即本 shadow root)。返回其值。
Sourcepub async fn s_ele(&self, selector: &str) -> Result<StaticElement>
pub async fn s_ele(&self, selector: &str) -> Result<StaticElement>
解析 shadow 内 HTML,取第一个匹配的静态元素。
Trait Implementations§
Source§impl Clone for ShadowRoot
impl Clone for ShadowRoot
Source§fn clone(&self) -> ShadowRoot
fn clone(&self) -> ShadowRoot
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ShadowRoot
impl !UnwindSafe for ShadowRoot
impl Freeze for ShadowRoot
impl Send for ShadowRoot
impl Sync for ShadowRoot
impl Unpin for ShadowRoot
impl UnsafeUnpin for ShadowRoot
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
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>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
Converts
&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)
Converts
&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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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>
Converts
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>
Converts
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