Skip to main content

cdp_driver/
config.rs

1//! Connection and viewport settings for [`BrowserAgent::connect_with_config`](crate::agent::BrowserAgent::connect_with_config).
2
3/// Connection and viewport settings shared by [`BrowserAgent`](crate::agent::BrowserAgent)
4/// and [`Cluster`](crate::cluster::Cluster).
5#[derive(Debug, Clone)]
6pub struct Config {
7    /// Chrome's remote-debugging host, e.g. `"localhost"`.
8    pub host: String,
9    /// Chrome's remote-debugging port, e.g. `9222`.
10    pub port: u16,
11    /// Viewport width in CSS pixels applied on connect.
12    pub viewport_width: i32,
13    /// Viewport height in CSS pixels applied on connect.
14    pub viewport_height: i32,
15    /// Directory screenshots are written to when a relative path is used.
16    pub screenshots_dir: String,
17}
18
19impl Default for Config {
20    fn default() -> Self {
21        Config {
22            host: "localhost".into(),
23            port: 9222,
24            viewport_width: 1920,
25            viewport_height: 1200,
26            screenshots_dir: "screenshots".into(),
27        }
28    }
29}