Skip to main content

Frame

Struct Frame 

Source
pub struct Frame { /* private fields */ }
Expand description

同源 iframe 的封装,可在该 frame 内直接查找元素(把 iframe 看作普通元素,逻辑更清晰)。

Implementations§

Source§

impl Frame

Source

pub fn frame_ele(&self) -> Element

返回 iframe 元素本身(与 DrissionPage frame_ele 一致)

Source

pub fn ele(&self, locator: &str) -> Result<Option<Element>, CdpError>

在本 frame 内按定位器查单个元素(与 DrissionPage 在 ChromiumFrame 上 ele() 一致)

Source

pub fn eles(&self, locator: &str) -> Result<Vec<Element>, CdpError>

在本 frame 内按定位器查多个元素(与 DrissionPage 在 ChromiumFrame 上 eles() 一致)

Source

pub fn element(&self, locator: &str) -> Result<Option<Element>, CdpError>

Frame::ele 一致

Source

pub fn elements(&self, locator: &str) -> Result<Vec<Element>, CdpError>

Frame::eles 一致

Source

pub fn wait( &self, locator: &str, timeout: Duration, ) -> Result<Element, CdpError>

在本 frame 内等待定位器匹配到元素,超时返回错误(与 Page::wait 一致,作用域为当前 frame)。

Source

pub fn run_js(&self, script: &str) -> Result<Value, CdpError>

在本 frame 的 document 上下文中执行 JS(脚本内可用 document,与主页面 run_js 一致),返回 CDP 的 result。

Trait Implementations§

Source§

impl Debug for Frame

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Frame

§

impl !RefUnwindSafe for Frame

§

impl Send for Frame

§

impl !Sync for Frame

§

impl Unpin for Frame

§

impl UnsafeUnpin for Frame

§

impl UnwindSafe for Frame

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V