Is there a way in Selenium (with Python) to enable the "Do-Not-Track"-function?
I mean the limitation of a browser (in my case: Firefox geckodriver) to retrieve the geolocation of the user.
I know that this is possible and here is a similar question on GitHub but 1.It's written in JavaScript and 2.It just doesn't work.
Does anyone know a solution?
Here is my code so far:
import selenium.webdriver
profile = FirefoxProfile()
profile.set_preference("javascript.enabled", False)
options = webdriver.firefox.options.Options()
options.headless = True
profile.update_preferences()
browser = webdriver.Firefox(firefox_profile=profile, options=options)
browser.get("https://thesafety.us/check-ip")
Thanks
I have found a solution. I simply have to add the following to my Code:
fp = webdriver.FirefoxProfile()
fp.DEFAULT_PREFERENCES['frozen']["privacy.trackingprotection.enabled"] = True
By the way, for example you can also replace dom.disable_open_during_load
with media.peerconnection.ice.default_address_only
to disable WebRTC.