pub struct Window { /* private fields */ }Expand description
A handle to a Firefox browser window.
The window owns a Firefox process and profile, and holds a reference to the shared ConnectionPool for WebSocket communication. When dropped, the process is automatically killed.
§Example
let window = driver.window().headless().spawn().await?;
// Get the initial tab
let tab = window.tab();
// Create a new tab
let new_tab = window.new_tab().await?;
// Close the window
window.close().await?;Implementations§
Source§impl Window
impl Window
Source§impl Window
impl Window
Sourcepub async fn set_proxy(&self, config: ProxyConfig) -> Result<()>
pub async fn set_proxy(&self, config: ProxyConfig) -> Result<()>
Sets a proxy for all tabs in this window.
Window-level proxy applies to all tabs unless overridden by tab-level proxy.
§Example
ⓘ
use firefox_webdriver::ProxyConfig;
// HTTP proxy for all tabs
window.set_proxy(ProxyConfig::http("proxy.example.com", 8080)).await?;
// SOCKS5 proxy with auth
window.set_proxy(
ProxyConfig::socks5("proxy.example.com", 1080)
.with_credentials("user", "pass")
.with_proxy_dns(true)
).await?;Sourcepub async fn clear_proxy(&self) -> Result<()>
pub async fn clear_proxy(&self) -> Result<()>
Clears the proxy for this window.
After clearing, all tabs use direct connection (unless they have tab-level proxy).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Window
impl !RefUnwindSafe for Window
impl Send for Window
impl Sync for Window
impl Unpin for Window
impl !UnwindSafe for Window
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