Home > Software design >  Open an incognito window using selenium in java?
Open an incognito window using selenium in java?

Time:08-24

I have a script that currently has a user logged in to a website on a regular chrome window but I also want to open an incognito chrome window to have another user log in to the same website. The website has SSO so opening another regular chrome tab will just log in the first user again and both users need to be signed in at the same time. Is there a way to launch an incognito chrome window from the regular chrome window with selenium?

CodePudding user response:

start you driver like below

WebDriver chromedriver;
ChromeOptions options = new ChromeOptions();
options.addArguments("--incognito");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver chromedriver=new ChromeDriver(capabilities);
  • Related