0

In my projects ScenarioSetup.java I am setting a few options via ChromeOptions and one of them is to open up the browser in incognito;

options.addArguments("--incognito");

Now I wanted to know if its possible to check ChromeOptions for within another class. Someone suggested to do the following, however it just throws a null pointer.

if (System.getProperty("chromeoptions.args").equals("--incognito")) {
  do something;
} else {
  do something else;
}
Daredevi1
  • 103
  • 3
  • 13
  • You can get some options by typing "chrome://version/" in the location bar and hitting enter. (you might also use Selenium to .get() that...) This should show any flags used at startup. – pcalkins Jan 26 '22 at 20:30
  • If you need to recognize the incognito mode only (not all the options ang args) see https://stackoverflow.com/questions/2909367/can-you-determine-if-chrome-is-in-incognito-mode-via-a-script – pburgr Jan 27 '22 at 07:30

0 Answers0