kroe761
kroe761

Reputation: 3534

Selenium - Use InternetExplorerOptions() when initializing RemoteWebDriver

I am trying to get IE to start each session clean when intializing a remote driver via the Selenium grid. This

DesiredCapabilities caps = null;
caps = DesiredCapabilities.internetExplorer();
caps.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
WebDriver driver = new RemoteWebDriver(new URL("http://10.10.22.126:5555/wd/hub"), caps);

is not working, IE is starting each new test with the cookies from the previous test, which causes issues. I am trying to implement this

InternetExplorerOptions ieOptions = new InternetExplorerOptions()
                .destructivelyEnsureCleanSession();

As dictated here, but I can't figure out how to use this as a remote driver instead of locally. Thanks!

Upvotes: 1

Views: 4539

Answers (1)

Naman
Naman

Reputation: 32036

You can set the option as a capability in somewhat this manner:

InternetExplorerOptions ieOptions = new InternetExplorerOptions()
         .destructivelyEnsureCleanSession();
capabilities.setCapability("se:ieOptions", ieOptions); 

The InternetExplorerOptions class defines the constant for this capability as:

private final static String IE_OPTIONS = "se:ieOptions";

Upvotes: 2

Related Questions