Skip to content

Commit 82c8c3c

Browse files
committed
[rust] add a command line message to output the first time Selenium Manager is used
This increases the awareness of users that they have the right to opt-out
1 parent 95fb4ce commit 82c8c3c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

rust/src/lib.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,8 @@ pub trait SeleniumManager {
866866

867867
fn stats(&self) -> Result<(), Error> {
868868
if !self.is_avoid_stats() && !self.is_offline() {
869+
let _report = first_report_msg();
870+
869871
let props = Props {
870872
browser: self.get_browser_name().to_ascii_lowercase(),
871873
browser_version: self.get_browser_version().to_ascii_lowercase(),
@@ -1674,3 +1676,18 @@ fn get_index_version(full_version: &str, index: usize) -> Result<String, Error>
16741676
.ok_or(anyhow!(format!("Wrong version: {}", full_version)))?
16751677
.to_string())
16761678
}
1679+
1680+
fn first_report_msg() -> Result<(), Error> {
1681+
let cache_dir = default_cache_folder();
1682+
let first_report_marker = cache_dir.join("initialized");
1683+
1684+
if !first_report_marker.exists() {
1685+
println!("\nSelenium Manager collects anonymous telemetry to improve the project.");
1686+
println!("Detailed information and instructions for opting out may be found at:");
1687+
println!("https://www.selenium.dev/privacy/\n");
1688+
1689+
create_path_if_not_exists(&cache_dir)?;
1690+
fs::write(first_report_marker, "")?;
1691+
}
1692+
Ok(())
1693+
}

0 commit comments

Comments
 (0)