Joshua Burns Joshua Burns - 1 month ago 8
C# Question

How to clear IE cache webdriver Selenium Grid DesiredCapabilities and InternetExplorerOptions

My original question was unclear I was really looking for a way to start IE with a clean session running on the Grid. I thought the Selenium solution to this was broken, turns out it was how I was using it :facepalm: So I have updated my question to reflect that part.

So my issue is that I cannot get IE to start in a clean session when I run it on Selenium Grid. I have done a fair share of research and implemented the

that is supposed to handle this for IE.
internetExplorerCapabilities.SetCapability(ieOptions.EnsureCleanSession.ToString(), true);

But sadly this is not working and I have opened a ticket with the selenium developers if you are interested in tracking it.


Your code ieOptions.EnsureCleanSession.ToString() will return true or false and not ensureCleanSession. To set the capability:

var options = new InternetExplorerOptions();
options.EnsureCleanSession = true;
options.RequireWindowFocus = true;

var capabilities = (DesiredCapabilities)options.ToCapabilities();
capabilities.SetCapability(CapabilityType.Version, "11");

var driver = new RemoteWebDriver(new Uri(""), capabilities);