How to use IE options with IWebDriver?

Viewed 2040

I have the following code which does exactly what I want:

private IWebDriver driver;
var options = new InternetExplorerOptions();
options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
driver = new InternetExplorerDriver(options);

However, people I work with need the driver variable to be a IWebDriver instead:

DesiredCapabilities capabilities = DesiredCapabilities.InternetExplorer();
capabilities.SetCapability("ie.ensureCleanSession", true);
driver = new RemoteWebDriver(new Uri(remoteAddress), capabilities, TimeSpan.FromSeconds(10));

So I was wondering if there is a way to set the following property:

options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;

using a RemoveWebDriver? Can I set it in DesiredCapabilities object?

Something like this maybe (can't find something like this):

capabilities.SetCapability("ie.IntroduceInstabilityByIgnoringProtectedModeSettings ", true);

Or to include the options object in RemoveWebDriver?

1 Answers
Related