4

My test script is navigating to report page, where it clicks "Download Report" button. After clicking it, an IE download dialog appears at the bottom of the page.

The issue is that it looks like driver is losing connection after clicking that button in IE. Looking for some possible workarounds. Both IEDriver and Webdriver nuget packages are the latets versions. This is C#. This issue is only in IE.

This is the error I am getting:

OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:52706/session/ea7da8ec-add0-4562-81c2-d2ebc706a073/click timed out after 60 seconds. ---> System.Net.WebException: The request was aborted: The operation has timed out.

1
  • Use a pageLoadStrategy of “eager” instead of “normal.”
    – JimEvans
    Sep 18, 2018 at 2:20

1 Answer 1

4

The problem here is that when IE is in the process of downloading a file, the readyState of the browser never moves from interactive to complete, meaning that the browser "wait for page load" detection never finishes. The way to stop this is to change the driver’s page load strategy on creation. The downside to this is that there is a chance that it will affect other operations in that the driver will return earlier from a page load than your code expects, so judicious use of WebDriverWait in other parts of your code will be required. The code to set the page load strategy is something like the following:

// DISCLAIMER: Code below written from memory,
// without benefit of Visual Studio or
// another IDE. It might require modification
// to work properly, or even to compile.
InternetExplorerOptions options = new InternetExplorerOptions;
options.PageLoadStrategy = PageLoadStrategy.Eager;
IWebDriver driver = new InternetExplorerDriver(options);
2
  • Thanks a lot! First, this solved the issue. Second, to bypass the possible downsides you listed, I tagged the specific Scenarios that need to click that button with a tag linked to BeforeScenario hook, that will start new sriver instance with that option set to Eager, so other Scenarios shouldn't be affected. Thanks again.
    – Razkar
    Sep 18, 2018 at 14:21
  • Thanks for your answer, I got the same error when I assign the URL for IE driver (browser.Url =...), but I can not use this method, Could you please give me your idea? Thanks/
    – KhaNguyen
    Aug 10, 2020 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.