pub struct WebView { /* private fields */ }Expand description
WebView type that includes inner implementation and delegate
Implementations§
Source§impl WebView
impl WebView
Sourcepub fn has_scheme_handler(&self, scheme: &str) -> bool
pub fn has_scheme_handler(&self, scheme: &str) -> bool
Check if a scheme handler is registered for the given scheme.
Call the navigation handler. Returns Allow if no handler is registered.
Sourcepub fn has_new_window_handler(&self) -> bool
pub fn has_new_window_handler(&self) -> bool
Check if a new-window handler is registered.
Sourcepub fn handle_new_window(&self, url: &str) -> NewWindowPolicy
pub fn handle_new_window(&self, url: &str) -> NewWindowPolicy
Call the new-window handler. Returns Cancel if no handler is registered.
pub async fn evaluate_javascript( &self, js: &str, ) -> Result<Value, WebViewScriptError>
pub async fn current_url(&self) -> Result<Option<String>, WebViewError>
pub fn reload(&self) -> Result<(), WebViewError>
pub fn go_back(&self) -> Result<(), WebViewError>
pub fn go_forward(&self) -> Result<(), WebViewError>
pub async fn take_screenshot(&self) -> Result<Vec<u8>, WebViewError>
pub async fn click( &self, selector: &str, options: ClickOptions, ) -> Result<(), WebViewInputError>
pub async fn type_text( &self, selector: &str, text: &str, options: TypeOptions, ) -> Result<(), WebViewInputError>
pub async fn fill( &self, selector: &str, text: &str, options: FillOptions, ) -> Result<(), WebViewInputError>
pub async fn press( &self, key: &str, options: PressOptions, ) -> Result<(), WebViewInputError>
pub async fn scroll( &self, dx: f64, dy: f64, options: ScrollOptions, ) -> Result<(), WebViewInputError>
pub async fn scroll_to( &self, selector: &str, options: ScrollOptions, ) -> Result<(), WebViewInputError>
Trait Implementations§
Source§impl WebViewController for WebView
impl WebViewController for WebView
Source§fn load_data(&self, request: LoadDataRequest<'_>) -> Result<(), WebViewError>
fn load_data(&self, request: LoadDataRequest<'_>) -> Result<(), WebViewError>
Load HTML data into the WebView.
Source§fn exec_js(&self, js: &str) -> Result<(), WebViewError>
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,
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,
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>
fn post_message(&self, message: &str) -> Result<(), WebViewError>
Post a message to the WebView
Source§fn clear_browsing_data(&self) -> Result<(), WebViewError>
fn clear_browsing_data(&self) -> Result<(), WebViewError>
Clear browsing data from the WebView
Source§fn set_user_agent(&self, ua: &str) -> Result<(), WebViewError>
fn set_user_agent(&self, ua: &str) -> Result<(), WebViewError>
Set the user agent string for the WebView
Source§fn go_forward(&self) -> Result<(), WebViewError>
fn go_forward(&self) -> Result<(), WebViewError>
Navigate forward in WebView history.
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.
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,
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
impl WebViewInputController for WebView
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,
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,
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,
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,
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,
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§
impl !Freeze for WebView
impl RefUnwindSafe for WebView
impl Send for WebView
impl Sync for WebView
impl Unpin for WebView
impl UnsafeUnpin for WebView
impl UnwindSafe for WebView
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