Fix: Suppress Google Translate bar in native headless mode (#649)
Fixes #617
(cherry picked from commit 492830accb)
This commit is contained in:
@@ -95,6 +95,7 @@ fn build_chrome_args(options: &LaunchOptions) -> Result<ChromeArgs, String> {
|
|||||||
"--disable-popup-blocking".to_string(),
|
"--disable-popup-blocking".to_string(),
|
||||||
"--disable-prompt-on-repost".to_string(),
|
"--disable-prompt-on-repost".to_string(),
|
||||||
"--disable-sync".to_string(),
|
"--disable-sync".to_string(),
|
||||||
|
"--disable-features=Translate".to_string(),
|
||||||
"--enable-features=NetworkService,NetworkServiceInProcess".to_string(),
|
"--enable-features=NetworkService,NetworkServiceInProcess".to_string(),
|
||||||
"--metrics-recording-only".to_string(),
|
"--metrics-recording-only".to_string(),
|
||||||
"--password-store=basic".to_string(),
|
"--password-store=basic".to_string(),
|
||||||
@@ -750,6 +751,19 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_build_args_disables_translate() {
|
||||||
|
let opts = LaunchOptions::default();
|
||||||
|
let result = build_chrome_args(&opts).unwrap();
|
||||||
|
assert!(result
|
||||||
|
.args
|
||||||
|
.iter()
|
||||||
|
.any(|a| a.contains("--disable-features") && a.contains("Translate")));
|
||||||
|
if let Some(ref dir) = result.temp_user_data_dir {
|
||||||
|
let _ = std::fs::remove_dir_all(dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_chrome_process_drop_cleans_temp_dir() {
|
fn test_chrome_process_drop_cleans_temp_dir() {
|
||||||
let dir = std::env::temp_dir().join(format!(
|
let dir = std::env::temp_dir().join(format!(
|
||||||
|
|||||||
Reference in New Issue
Block a user