From 1be956d27668dcf2052ea82b191ae1917e6cb11b Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Wed, 4 Aug 2021 17:22:09 +0200 Subject: feat: instance new browser with a real typo user-agent --- src/browser/web_browser.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/browser/web_browser.rs') diff --git a/src/browser/web_browser.rs b/src/browser/web_browser.rs index da8bcd1..804c82f 100644 --- a/src/browser/web_browser.rs +++ b/src/browser/web_browser.rs @@ -12,12 +12,17 @@ pub struct Browser { impl Browser { pub async fn new(driver_url: &String) -> Self { + let user_agent = + "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0"; + + let mut prefs = FirefoxPreferences::new(); + let _ = prefs.set_user_agent(user_agent.to_string()); + + let mut caps = FirefoxCapabilities::new(); + let _ = caps.set_preferences(prefs); + Self { - driver: Some( - WebDriver::new(driver_url, FirefoxCapabilities::new()) - .await - .unwrap(), - ), + driver: Some(WebDriver::new(driver_url, caps).await.unwrap()), } } -- cgit v1.2.3-18-g5258