Struct browser_window::browser::BrowserWindowHandle
source · pub struct BrowserWindowHandle { /* private fields */ }
Expand description
This is a handle to an existing browser window.
Implementations§
source§impl BrowserWindowHandle
impl BrowserWindowHandle
sourcepub fn app(&self) -> ApplicationHandle
pub fn app(&self) -> ApplicationHandle
Returns the application handle associated with this browser window.
pub fn close(self)
sourcepub async fn eval_js(&self, js: &str) -> Result<JsValue, JsEvaluationError>
pub async fn eval_js(&self, js: &str) -> Result<JsValue, JsEvaluationError>
Executes the given javascript code and returns the output as a string.
If you don’t need the result, see exec_js
.
There may be some discrepancies in what JS values are being returned for
the same code in different browser engines, or how accurate they are.
For example, Edge WebView2 doesn’t return JsValue::Undefined
, it uses
JsValue::Null
instead.
sourcepub fn exec_js(&self, js: &str)
pub fn exec_js(&self, js: &str)
Executes the given javascript code without waiting on it to finish.
Causes the browser to navigate to the given url.
pub fn url<'a>(&'a self) -> Cow<'a, str>
pub fn window(&self) -> &WindowHandle
Methods from Deref<Target = WindowHandle>§
pub fn content_dimensions(&self) -> Dims2D
pub fn opacity(&self) -> u8
pub fn position(&self) -> Pos2D
pub fn title(&self) -> String
pub fn window_dimensions(&self) -> Dims2D
sourcepub fn hide(&self)
pub fn hide(&self)
Hides the window. Keep in mind that hiding the window is not the same as closing it. Hiding the window will keep it’s resources alive. If the window is hidden, and all window handles are gone, the memory is effectively leaked.