Run chrome browser in inconginto Mode in Selenium

0 votes

I want to run chrome in incognito mode through selenium. I googled enough for it and found how to run chrome directly in incognito mode, and  found this:

  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.

Jul 31, 2018 in Selenium by Sahiti
• 6,380 points
24,724 views

1 answer to this question.

0 votes

One other way to launch Chrome in incognito mode is add argument -incognito like following

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

For further understanding, you can refer to the Selenium Training.

answered Jul 31, 2018 by Meci Matt
• 9,460 points
It Worked for me!
It's not working for me.I am using Intellije ,windows10

Can you share what's the error you are facing? 

Also you can try using something like this: 

  1. Check if Allow in incognito is switched On for JetBrains IDE Support extension (chrome://extensions/)
  2. open WebStorm preferences -> Tools -> Web browsers -> Chrome -> Edit -> Command line options: -incognito

Related Questions In Selenium

0 votes
1 answer

How to run Selenium test cases in Headless Chrome browser?

@Afreen to run selenium test cases in ...READ MORE

answered May 17, 2019 in Selenium by Kushal
3,019 views
0 votes
1 answer

Selenium ChromeDriver issue - Want to run it in background, but not as headless browser

This is a flaw with ChromeDriver. Tried ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,500 points
5,724 views
0 votes
2 answers

Can anyone help me that how to run Selenium WebDriver test cases in Chrome?

You first need to download chrome driver ...READ MORE

answered Aug 26, 2019 in Selenium by Abha
• 28,060 points
1,072 views
0 votes
1 answer

Selenium grid 2 in chrome browser

The problem is in -Dwebdriver arguments. Maybe you should do ...READ MORE

answered Apr 27, 2018 in Selenium by Samarpit
• 5,890 points
654 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
6,212 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
6,573 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
4,198 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
5,203 views
0 votes
8 answers

How to open a link in new tab of chrome browser using Selenium WebDriver?

This below code works for me in ...READ MORE

answered Dec 14, 2020 in Selenium by Gitika
• 65,970 points
81,190 views
0 votes
1 answer

Opening Browser in Selenium

Here is the code to open the ...READ MORE

answered Apr 20, 2018 in Selenium by Meci Matt
• 9,460 points
146 views