pub struct Profile { /* private fields */ }Expand description
A Firefox profile directory.
Manages a Firefox profile, which contains settings, extensions, and state. Profiles can be temporary (auto-cleanup) or persistent (user-managed).
§Temporary Profiles
Created with Profile::new_temp(), these are automatically deleted
when the Profile is dropped.
§Persistent Profiles
Created with Profile::from_path(), these persist after the program exits.
Implementations§
Source§impl Profile
impl Profile
Sourcepub fn new_temp() -> Result<Self>
pub fn new_temp() -> Result<Self>
Creates a new temporary profile.
The profile directory is created in the system temp directory with a unique name. It is automatically deleted when the Profile is dropped.
§Errors
Returns an error if the temporary directory cannot be created.
§Example
use firefox_webdriver::driver::profile::Profile;
let profile = Profile::new_temp()?;
println!("Profile at: {}", profile.path().display());Sourcepub fn from_path(path: impl Into<PathBuf>) -> Result<Self>
pub fn from_path(path: impl Into<PathBuf>) -> Result<Self>
Uses an existing profile directory.
If the directory doesn’t exist, it is created.
§Arguments
path- Path to the profile directory
§Errors
Returns an error if the directory cannot be created.
§Example
use firefox_webdriver::driver::profile::Profile;
let profile = Profile::from_path("./my_profile")?;Source§impl Profile
impl Profile
Sourcepub fn write_prefs(&self, prefs: &[FirefoxPreference]) -> Result<()>
pub fn write_prefs(&self, prefs: &[FirefoxPreference]) -> Result<()>
Sourcepub fn default_prefs() -> Vec<FirefoxPreference>
pub fn default_prefs() -> Vec<FirefoxPreference>
Returns the default preferences for WebDriver automation.
These preferences configure Firefox for automation:
- Allow unsigned extensions
- Disable telemetry
- Disable updates
- Enable fingerprint randomization