The other question would be what is testing in private mode going to tell you?
Are you trying to test that the browser history is not stored when using private mode? If so you aren’t testing your website, you’re testing the browser (and wasting a lot of time).
So basically you are testing that private mode works. You cannot force people to set their browser up in a certain way so you cannot be sure that they are accepting your cookies.
To quote Mozilla’s support page:
What does Private Browsing not save?
· Visited pages: No pages will be added to the list of sites in the History menu, the Library window's history list, or the Awesome Bar address list.
· Form and Search Bar entries: Nothing you enter into text boxes on web pages or the Search bar - Easily choose your favorite search engine will be saved for Control whether Firefox automatically fills in forms with your information.
· Passwords: No new passwords will be saved.
· Download List entries: No files you download will be listed in the Use the Downloads window to manage downloaded files after you turn off Private Browsing.
· Cookies: Cookies - Information that websites store on your computer store information about websites you visit such as site preferences, login status, and data used by plugins like Adobe Flash. Cookies can also be used by third parties to track you across web sites. For more info about tracking, see How do I turn on the Do-not-track feature?
Note: To prevent Flash from storing cookies, you must be using its latest version. See Updating Flashfor instructions.
· Cached Web Content and Offline Web Content and User Data: No temporary Internet files (cachedfiles) or files that websites save for offline use will be saved.
Note:
· If you create new Bookmarks while using Private Browsing, they will not be removed when you stop Private Browsing.
· If you save files to your computer while using Private Browsing, they will not be deleted when you stop Private Browsing. However, any files you open in an external application will be cleared from the system's temporary folder, and none of the files you download will appear in the Use the Downloads window to manage downloaded files list.
If you really want to force private mode have a look at:
I would suggest setting up a private browsing profile and a normal profile and switching between them for your testing. There have been lots of posts about custom profiles in this list.
FirefoxProfile firefoxProfile = new FirefoxProfile();firefoxProfile.setPreference("browser.private.browsing.autostart", true);
FirefoxProfile fp = new FirefoxProfile();
fp.setPreference("browser.privatebrowsing.autostart", true); //I have checked in about:config and there is no period between private and browsingdv = new FirefoxDriver();
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/ce95025c-19f8-4eb6-b17b-cadc9fd8bbe1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.