Skip to content

Instantly share code, notes, and snippets.

@diemol
Created December 21, 2017 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diemol/1a0c15eccdc3712a76a5a3782e5c4fbd to your computer and use it in GitHub Desktop.
Save diemol/1a0c15eccdc3712a76a5a3782e5c4fbd to your computer and use it in GitHub Desktop.
FirefoxProfile firefoxHeadlessProfile = new FirefoxProfile
{
DeleteAfterUse = true
};
firefoxHeadlessProfile.SetPreference("browser.cache.disk.enable", false);
firefoxHeadlessProfile.SetPreference("browser.cache.memory.enable", false);
firefoxHeadlessProfile.SetPreference("browser.cache.offline.enable", false);
firefoxHeadlessProfile.SetPreference("network.http.use-cache", false);
FirefoxOptions firefoxHeadlessOptions = new FirefoxOptions
{
Profile = firefoxHeadlessProfile
};
firefoxHeadlessOptions.AddArgument("--headless");
// Cast to DesiredCapabilities from the ICapabilities interface to make it mutable
DesiredCapabilities desiredCapabilities = (DesiredCapabilities) firefoxHeadlessOptions.ToCapabilities();
desiredCapabilities.SetCapability("idleTimeout", 300);
desiredCapabilities.SetCapability("tz", "America/Chicago");
desiredCapabilities.SetCapability("recordVideo", EnableZaleniumVideoRecording);
IWebDriver WebDriver = new RemoteWebDriver(GridHubUri, desiredCapabilities, GridCommandTimeout);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment