Run chrome browser in inconginto Mode in Selenium

0
0

I want to run chrome in incongito mode through selenium.
I googled enough for it and found how to run chrome directly in incongito mode with the help of this link:

  1. Right click on the shortcut of Google Chrome and select “Properties”.
  2. On “Shortcut” tab on the “Target” field add an –incognito to the end of program path. So in the “Target” field you should have "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" –incognito

but I didn’t get how to run this in selenium.

  • You must to post comments
0
0

One other way to launch chrome in incognito mode is add arugument -incognito like following

ChromeOptions options = new ChromeOptions();
options
.addArguments("--incognito");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities
.setCapability(ChromeOptions.CAPABILITY, options);

This solution works for me.

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website