So I am trying to use a selenium web driver extension on chrome to record a web application test on a chrome browser that is in an incognito mode. How do you run a test on a web application in an incognito mode of google chrome browser?

3 Answers 3


you can't record the browser actions with selenium webdriver. This is possible only with Selenium IDE.

So to answer to you question:

You can't make Selenium IDE to open chrome in incognito mode. If you want to achieve a similar functionality in non incognito mode in chrome using Selenoium IDE you can execute javascript to clear the local storage and cookies.


While working in a software testing services company, I have experienced such requirement i.e. verifying certain scenarios in chrome incognito mode using Selenium Webdriver.
Please find below code snippet working at my end -

import org.openqa.selenium.WebDriver;                                
import org.openqa.selenium.chrome.ChromeDriver;                      
import org.openqa.selenium.chrome.ChromeOptions;

public class IncognitoTestCase {                                     
    public static void main(String[] args){  
    ChromeOptions options = new ChromeOptions(); 
    WebDriver driver =  new ChromeDriver(options); 

Selenium by default runs a clean browser session that gets deleted after test run and that is what incognito mode basically does.

You can, however, force the mode

--incognito: Forces Incognito mode even if user data directory is specified using the --user-data-dir switch.

from selenium import webdriver

chrome_options = webdriver.ChromeOptions()

driver = webdriver.Chrome(chrome_options=chrome_options)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.