2

Actually i want to open a incognito/private mode of firefox browser through selenium , but everytime i tried it was opening firefox in normal mode.

After some googling I got this code,which i used to open private mode in firefox through selenium but it is not working.

    FirefoxProfile firefoxProfile = new FirefoxProfile();

    firefoxProfile.setPreference("browser.privatebrowsing.autostart", true);
    WebDriver driver = new FirefoxDriver(firefoxProfile);

    driver.get("http://www.google.com");

can someone help how to do this?

tempEngineer
  • 223
  • 1
  • 3
  • 13
  • Quick question, could you tell us the reason? Selenium always creates new profile so I'm curious why you need to use private mode. – Buaban Nov 04 '16 at 11:04
  • Possible duplicate of [How to open incognito/private window with Selenium WD for different browser types?](http://stackoverflow.com/questions/33224070/how-to-open-incognito-private-window-with-selenium-wd-for-different-browser-type) – Nicole Phillips Nov 04 '16 at 14:10
  • @NicolePhillips i know but the problem here is that that code is not working at all. – tempEngineer Nov 06 '16 at 15:02
  • @Buaban yeah it's true but i need to open it incognito mode also – tempEngineer Nov 06 '16 at 15:03

0 Answers0