Home > database >  Mismatch in UserAgent initiating Firefox manually and using GeckoDriver
Mismatch in UserAgent initiating Firefox manually and using GeckoDriver

Time:02-11

Why is not the useragent the same in both cases?

https://www.whatsmyua.info/ reports the following when I browse with usual Firefox:

Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0

However, browsing with geckodriver reports:

Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0

Here's how I start browsing with geckodriver:

options=Options()
profile_path = '/home/myuser/.mozilla/firefox/x9zoqd7t.default-release/'
options.set_preference('profile', profile_path)
service = Service('/usr/local/bin/geckodriver')
driver = Firefox(service=service, options=options)
driver.get("http://www.whatsmyua.info/")

CodePudding user response:

Manually accessing Firefox v97.0 and accessing Selenium driven GeckoDriver v0.30.0 initiated Browsing Context, either way I see the same User Agent as follows:

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0

The most probhable reason for the mismatch is, you have 2 instances of Firefox browser installed.

The instance which you are accessing manually haven't been updated since it's previous version of 96.0, where as the instance installed at the location /home/myuser/.mozilla/firefox/ haven't been updated since 91.0. Hence you observe the difference in the useragent

  • Related