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:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" –incognito
but I didn't get how to run this in selenium.
There are two main ways to execute our selenium Test in Incognito Mode for Chrome Browser. v Right Click on Google Chrome and Select Properties. v In the “Target' field add an –incognito to the end of the program path. v Our incognito browser is now ready for execution.
Before you can run tests in Incognito mode in your Chrome browser, you need to allow the Testim extension to run in Incognito mode. To allow the Testim Chrome extension to run in Incognito mode: In your Chrome browser, navigate to chrome://extensions URL. Locate the Testim Editor extension and click the Details button.
One other way to launch chrome in incognito mode is to add argument "-incognito" like following:
ChromeOptions options = new ChromeOptions(); options.addArguments("--incognito"); DesiredCapabilities capabilities = DesiredCapabilities.chrome(); capabilities.setCapability(ChromeOptions.CAPABILITY, options);
This solution works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With