Start Firefox in incognito mode on a remote desktop cradle

You can use the following Java code to start the Chrome browser in incognito mode. Make sure to change the capabilities as per the requirements of your project.

Copy
DesiredCapabilities capabilities = new DesiredCapabilities();
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("browser.private.browsing.autostart",true);
capabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);
capabilities.setCapability("platformName", "Windows");
capabilities.setCapability("platformVersion", "10");
capabilities.setCapability("browserName", "Firefox");
capabilities.setCapability("browserVersion", "latest");
capabilities.setCapability("resolution", "1280x1024");
capabilities.setCapability("location", "US East");

If necessary, import the following packages:

Copy
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;