Running FireFox Browser in Incognito (Private) using Selenium



Running FireFox Browser in Incognito (Private) using Selenium


In this Blog, we are going to learn how we can execute Selenium Automation Test in Incognito (Private) Mode for FireFoxDriver.

Before Going Further, let's Understand what is Incognito (Private) Mode.


Incognito mode is a setting in our web browser that prevents Internet browsing history, cookies and site data, or information entered in forms from being storedIncognito mode deletes this data as soon as we close the web browser.

There are two main ways to execute our selenium Test in Incognito Mode for FireFox Driver.



First Method
  •  Right Click on Firefox Driver and Select Properties. 
   In the “Target’ field add –private to the end of the program path. 


    Now, Our incognito browser is ready for execution. Now whenever we execute our automation Scripts it will automatically execute in incognito mode for FireFox Driver.




Second Method

Using FireFox to addArguments –private in the code.

Please refer below code snippet for Complete Details.


After executing the Code, Result will be like:



Happy Learning.


SHARE THIS

Author:

My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post