How to run Automation test in incognito mode in Java-Selenium on LambdaTest?

How to run automation test in incognito mode in Java-Selenium on LambdaTest?

Hello Emma,

It is simple to run Automation test in incognito mode in Java Selenium on LambdaTest.

You can use the below code snippet to to set browser to incognito mode (Chrome).

ChromeOptions options = new ChromeOptions ();
// Setting chrome flag for incognito mode
options.addArguments("--incognito");
caps.setCapability(ChromeOptions.CAPABILITY, options);

You can also refer to the below GitHub repo for the above scenario -