I have updated IE Driver to 3.12.0.0 and it is not working. I get the below error message

Code:

DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
System.setProperty("webdriver.ie.driver", "C:\\iedriver\\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver(cap);
driver.manage().window().maximize();
driver.manage().deleteAllCookies();

Error Message from Console

Unable to create new remote session. desired capabilities = Capabilities [{ie.ensureCleanSession=true}], required capabilities = Capabilities [{}]
1

There are 1 answers

0
undetected Selenium On

You were almost there. You need to use the method merge() method from MutableCapabilities Class to merge the DesiredCapabilities type of object into InternetExplorerOptions type object and initiate the WebDriver and WebClient instance by passing the InternetExplorerOptions object as follows :

System.setProperty("webdriver.ie.driver", "C:\\iedriver\\IEDriverServer.exe");
DesiredCapabilities cap = DesiredCapabilities.internetExplorer();
cap.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
InternetExplorerOptions options = new InternetExplorerOptions()
options.merge(cap);
WebDriver driver = new InternetExplorerDriver(options);

PS : As a reference you can have a look at the discussions in mutablecapabilities tag