0

When I try to clear all cookies in the Internet explorer, the webdriver (IEDriverServer) crashes. The error does not appear in other scenarios.

View screenshot

.Net (c#) code:

 public override IWebDriver CreateRemoteDriver()
    {
        var options = GetOptions();
        return new RemoteWebDriver(new Uri(GridUri), options.ToCapabilities());
    }
public InternetExplorerOptions GetOptions()
    {
        InternetExplorerOptions options = new InternetExplorerOptions
        {
            IntroduceInstabilityByIgnoringProtectedModeSettings = true,
            InitialBrowserUrl = "about:blank",
            EnableNativeEvents = true,
            EnsureCleanSession = true,
            EnablePersistentHover = false,

        };

        switch (Version)
        {
            case "9":
            case "10":
                options.UsePerProcessProxy = false;
                break;
            case "11":
                options.UsePerProcessProxy = true;
                break;
        }


        var str = GetStrategyValueOrNull();
        if (str != null)
            options.AddAdditionalCapability(PageLoadStrategyCapabilityName, str);

        foreach (var capability in CapabilityProperties)
        {
            options.AddAdditionalCapability(capability.Name, capability.Value);
        }

        options.Proxy = GetNewProxy();
        return options;
    }
public void DeleteAllCookie()
    {
        Driver.Manage().Cookies.DeleteAllCookies();
    }
static void Main(string[] args)
    {
        var wd = new WebDriverManager();
        try
        {
            wd.Config = new IEWebDriverConfig
            {
                IsGrid = true,
                GridUri = "http://example:4435/wd/hub",
            };
            var url = "https://example.com/index.html";
            wd.Driver.Navigate().GoToUrl(url);
            wd.DeleteAllCookie();
            Console.ReadKey();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
        }
        finally
        {
            wd.Quit();
        }
    }

I use the following versions:

  • Selenium Standalone Server - 3.11.0
  • Internet Explorer Driver Server - 3.9.0 (x32)
  • Windows 10 IE 11.1480.14393
  • .NET Framework 4.6.1

stack trace:

System.Exception: Delete all cookie ---> OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://secret:4435/wd/hub/session/f4e86b53-80dc-49e7-88ef-a102d322b7a8/cookie timed out after 60 seconds. ---> System.Net.WebException: The request was aborted: The operation has timed out.
   at System.Net.HttpWebRequest.GetResponse()
   at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
   --- End of inner exception stack trace ---
   at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
   at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteCookieJar.DeleteAllCookies()
   at QA.AutomatedMagic.Managers.WebDriverManager.WebDriverManager.DeleteAllCookie() in C:\mypath\WebDriverManager.cs:line 1055
   --- End of inner exception stack trace ---
   at QA.AutomatedMagic.Managers.WebDriverManager.WebDriverManager.DeleteAllCookie() in C:\mypath\WebDriverManager.cs:line 1060
   at QA.AutomatedMagic.Managers.Test.Program.Main(String[] args) in C:\mypath\Program.cs:line 33
Richardok
  • 31
  • 5
  • Error stack trace please. – undetected Selenium Mar 14 '18 at 09:48
  • at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.Remote.RemoteCookieJar.DeleteAllCookies() at QA.AutomatedMagic.Managers.WebDriverManager.WebDriverManager.DeleteAllCookie(ILogger log) – Richardok Mar 14 '18 at 09:52
  • When you highlight the error the trace logs gets truncated and debugging becomes difficult. I have removed the highlight markup. – undetected Selenium Mar 14 '18 at 10:06
  • 2
    Four things. First, you’re using `IntroduceInstabilityByIgnoringProtectedModeSettings`. [Don’t do that.](http://jimevansmusic.blogspot.com/2012/08/youre-doing-it-wrong-protected-mode-and.html) Second, you’re attempting to set the initial browser URL to “about:blank”. Don’t do that either. Third, I’m surprised `AddAdditionalCapability` doesn’t throw for the page load strategy. There’s a property for that; you should use it. Finally, what happens when you use IE driver 3.11.1? Cookie handling has been overhauled in that version. Failing that, does it succeed with the 64-bit driver? – JimEvans Mar 14 '18 at 10:25
  • 1
    Also, your question doesn’t show how you’re calling `DeleteAllCookies`. If you’re trying to do that from the `about:blank` page, it won’t work at all. A trace-level log from the IE driver would be helpful. – JimEvans Mar 14 '18 at 10:33
  • I deleted the following options: IntroduceInstabilityByIgnoringProtectedModeSettings, InitialBrowserUrl. i also removed: options.AddAdditionalCapability (PageLoadStrategyCapabilityName, str); I tried to use IE 3.11. Nothing helped, the question remains open I don't know where to get access to trace-level log from the IE driver =( – Richardok Mar 14 '18 at 11:37
  • To question added implementation of method DeleteAllCookie() – Richardok Mar 14 '18 at 11:42
  • Thanks @JimEvans for the wonderful insights. – undetected Selenium Mar 14 '18 at 12:07
  • @Richardok There were two hints to try, `IEDriverServer.exe` 3.11.1 (the last “.1” is critical), and try the 64-bit driver. Also, what happens if you run it locally (not using grid/`RemoteWebDriver`)? Generating a log from the driver can be done via the `InternetExplorerDriverService` class, which is used in local, not remote, execution. – JimEvans Mar 14 '18 at 13:49

0 Answers0