pub struct BrowserConfig {
pub webdriver_url: String,
pub browser: BrowserType,
pub headless: bool,
pub viewport_width: u32,
pub viewport_height: u32,
pub page_load_timeout_secs: u64,
pub script_timeout_secs: u64,
pub implicit_wait_secs: u64,
pub user_agent: Option<String>,
pub browser_args: Vec<String>,
pub require_explicit_start: bool,
pub chrome_options: BTreeMap<String, Value>,
}Expand description
Configuration for browser sessions.
Fields§
§webdriver_url: StringWebDriver server URL (e.g., “http://localhost:4444”)
browser: BrowserTypeBrowser type to use
headless: boolRun in headless mode (no visible window)
viewport_width: u32Viewport width in pixels
viewport_height: u32Viewport height in pixels
page_load_timeout_secs: u64Page load timeout in seconds
script_timeout_secs: u64Script execution timeout in seconds
implicit_wait_secs: u64Implicit wait timeout in seconds
user_agent: Option<String>User agent string override
browser_args: Vec<String>Additional browser arguments
require_explicit_start: boolRequire the host to start the session, and to start it again after it is lost, instead of tools starting or recreating it on first use.
chrome_options: BTreeMap<String, Value>Chrome options under goog:chromeOptions, such as binary and prefs, supplied by
the execution host. Chrome only. Command-line flags belong in browser_args; an
args entry here is rejected when the session starts.
Implementations§
Source§impl BrowserConfig
impl BrowserConfig
Sourcepub fn webdriver_url(self, url: impl Into<String>) -> Self
pub fn webdriver_url(self, url: impl Into<String>) -> Self
Set the WebDriver URL.
Sourcepub fn browser(self, browser: BrowserType) -> Self
pub fn browser(self, browser: BrowserType) -> Self
Set the browser type.
Sourcepub fn page_load_timeout(self, secs: u64) -> Self
pub fn page_load_timeout(self, secs: u64) -> Self
Set page load timeout.
Sourcepub fn user_agent(self, ua: impl Into<String>) -> Self
pub fn user_agent(self, ua: impl Into<String>) -> Self
Set a custom user agent.
Sourcepub fn require_explicit_start(self, required: bool) -> Self
pub fn require_explicit_start(self, required: bool) -> Self
Require explicit BrowserSession::start() calls instead of automatic startup.
§Example
use adk_browser::BrowserConfig;
let config = BrowserConfig::new().require_explicit_start(true);
assert!(config.require_explicit_start);Sourcepub fn chrome_option(self, name: impl Into<String>, value: Value) -> Self
pub fn chrome_option(self, name: impl Into<String>, value: Value) -> Self
Set a Chrome option under goog:chromeOptions, such as binary or prefs.
Command-line flags belong in add_arg; an args option is
rejected when the session starts.
§Example
use adk_browser::BrowserConfig;
let config = BrowserConfig::new()
.chrome_option("binary", serde_json::json!("/opt/chromium"))
.chrome_option("prefs", serde_json::json!({"download.default_directory": "/tmp/dl"}));
assert_eq!(config.chrome_options["binary"], "/opt/chromium");Sourcepub fn observable(self) -> Self
pub fn observable(self) -> Self
Configure for observable mode (noVNC-compatible).
Sets headless: false and viewport to 1280x720 for noVNC viewing.
Use this when running with Selenium’s noVNC viewer (port 7900).