Referring to the @Laas's point at How might I simulate a private browsing experience in Watir? (Selenium):
Selenium is equivalent to turning on Private Browsing.
And the definition of "Private Browsing":
Private Browsing allows you to browse the Internet without saving any
information about which sites and pages you’ve visited.
And since every time you start firefox through selenium webdriver it creates a brand new anonymous profile, you are actually browsing privately.
If you still want to force the private mode in Firefox, set the browser.privatebrowsing.autostart
configuration option to true
:
from selenium import webdriver
firefox_profile = webdriver.FirefoxProfile()
firefox_profile.set_preference("browser.privatebrowsing.autostart", True)
driver = webdriver.Firefox(firefox_profile=firefox_profile)
Also, see:
- Python/Selenium incognito/private mode