summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-08-04 17:22:09 +0200
committerSanto Cariotti <santo@dcariotti.me>2021-08-04 17:22:09 +0200
commit1be956d27668dcf2052ea82b191ae1917e6cb11b (patch)
tree9b2c922bc03a3c70532f3edd3c8bb161509a7251
parente4971fdadfda1de6038274df5f163077de1acb4e (diff)
feat: instance new browser with a real typo user-agent
-rw-r--r--src/browser/web_browser.rs15
1 files changed, 10 insertions, 5 deletions
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()),
}
}