Skip to main content

WebView

Struct WebView 

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

WebView type that includes inner implementation and delegate

Implementations§

Source§

impl WebView

Source

pub fn appid(&self) -> String

Get the appid

Source

pub fn path(&self) -> String

Get the path

Source

pub fn webtag(&self) -> WebTag

Get the webtag (computed from appid and path)

Source

pub fn has_scheme_handler(&self, scheme: &str) -> bool

Check if a scheme handler is registered for the given scheme.

Source

pub fn handle_navigation(&self, url: &str) -> NavigationPolicy

Call the navigation handler. Returns Allow if no handler is registered.

Source

pub fn has_new_window_handler(&self) -> bool

Check if a new-window handler is registered.

Source

pub fn handle_new_window(&self, url: &str) -> NewWindowPolicy

Call the new-window handler. Returns Cancel if no handler is registered.

Source

pub async fn evaluate_javascript( &self, js: &str, ) -> Result<Value, WebViewScriptError>

Source

pub async fn current_url(&self) -> Result<Option<String>, WebViewError>

Source

pub fn reload(&self) -> Result<(), WebViewError>

Source

pub fn go_back(&self) -> Result<(), WebViewError>

Source

pub fn go_forward(&self) -> Result<(), WebViewError>

Source

pub async fn list_cookies(&self) -> Result<Vec<WebViewCookie>, WebViewError>

Source

pub async fn clear_cookies(&self) -> Result<(), WebViewError>

Source

pub async fn take_screenshot(&self) -> Result<Vec<u8>, WebViewError>

Source

pub async fn click( &self, selector: &str, options: ClickOptions, ) -> Result<(), WebViewInputError>

Source

pub async fn type_text( &self, selector: &str, text: &str, options: TypeOptions, ) -> Result<(), WebViewInputError>

Source

pub async fn fill( &self, selector: &str, text: &str, options: FillOptions, ) -> Result<(), WebViewInputError>

Source

pub async fn press( &self, key: &str, options: PressOptions, ) -> Result<(), WebViewInputError>

Source

pub async fn scroll( &self, dx: f64, dy: f64, options: ScrollOptions, ) -> Result<(), WebViewInputError>

Source

pub async fn scroll_to( &self, selector: &str, options: ScrollOptions, ) -> Result<(), WebViewInputError>

Trait Implementations§

Source§

impl WebViewController for WebView

Source§

fn load_url(&self, url: &str) -> Result<(), WebViewError>

Load a URL in the WebView
Source§

fn load_data(&self, request: LoadDataRequest<'_>) -> Result<(), WebViewError>

Load HTML data into the WebView.
Source§

fn exec_js(&self, js: &str) -> Result<(), WebViewError>

Execute JavaScript in the WebView without observing its return value.
Source§

fn eval_js<'life0, 'life1, 'async_trait>( &'life0 self, js: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Value, WebViewScriptError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Evaluate JavaScript in the WebView and return the decoded JSON value. Read more
Source§

fn current_url<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, WebViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the platform WebView’s current URL.
Source§

fn post_message(&self, message: &str) -> Result<(), WebViewError>

Post a message to the WebView
Source§

fn clear_browsing_data(&self) -> Result<(), WebViewError>

Clear browsing data from the WebView
Source§

fn set_user_agent(&self, ua: &str) -> Result<(), WebViewError>

Set the user agent string for the WebView
Source§

fn reload(&self) -> Result<(), WebViewError>

Reload the current WebView document.
Source§

fn go_back(&self) -> Result<(), WebViewError>

Navigate back in WebView history.
Source§

fn go_forward(&self) -> Result<(), WebViewError>

Navigate forward in WebView history.
Source§

fn list_cookies<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<WebViewCookie>, WebViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List HTTP cookies from the platform WebView cookie store.
Set an HTTP cookie through the platform WebView cookie store.
Delete an HTTP cookie from the platform WebView cookie store.
Source§

fn clear_cookies<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), WebViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Clear all HTTP cookies from the platform WebView cookie store.
Source§

fn take_screenshot<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, WebViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Capture a PNG screenshot of the WebView’s visible content. Returns raw PNG-encoded bytes ready to be base64’d over the wire.
Source§

impl WebViewInputController for WebView

Source§

fn click<'life0, 'life1, 'async_trait>( &'life0 self, _selector: &'life1 str, _options: ClickOptions, ) -> Pin<Box<dyn Future<Output = Result<(), WebViewInputError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn type_text<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _selector: &'life1 str, _text: &'life2 str, _options: TypeOptions, ) -> Pin<Box<dyn Future<Output = Result<(), WebViewInputError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn fill<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _selector: &'life1 str, _text: &'life2 str, _options: FillOptions, ) -> Pin<Box<dyn Future<Output = Result<(), WebViewInputError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn press<'life0, 'life1, 'async_trait>( &'life0 self, _key: &'life1 str, _options: PressOptions, ) -> Pin<Box<dyn Future<Output = Result<(), WebViewInputError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn scroll<'life0, 'async_trait>( &'life0 self, _dx: f64, _dy: f64, _options: ScrollOptions, ) -> Pin<Box<dyn Future<Output = Result<(), WebViewInputError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn scroll_to<'life0, 'life1, 'async_trait>( &'life0 self, _selector: &'life1 str, _options: ScrollOptions, ) -> Pin<Box<dyn Future<Output = Result<(), WebViewInputError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Auto Trait Implementations§

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, 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.