IE11 Driver can't do any action in a browser with the download bar visible
Hi All, I'll try to explain the issue that I'm having. I'm working in a browser instances, after a click a second instance is open an on it is the file download bar visible, when I try to change the focus to the second instance with myDriver.SwitchTo.Window(UID) I got a time out error. Trying to workaround in I found that is not possible to do any action on that browser instance, for example I tried with myDriver.Title and myDriver.Url and both of them return the time out error.
Selenium C# v2.47 OS: Win7 Browser: IE11 - IEDriverServer_Win32 - v2.47
This is the exception StackTrace:
OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:6853/session/1fecf44f-2fb9-4226-9e00-bf8565ff204f/window timed out after 60 seconds.
---> System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)
--- End of inner exception stack trace ---
at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.InternalExecute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteTargetLocator.Window(String windowName)
This is how the IE driver is generated: Dim opt As New IE.InternetExplorerOptions opt.InitialBrowserUrl = "about:blank" opt.RequireWindowFocus = True opt.EnableNativeEvents = True 'with false some link are not clicked opt.EnablePersistentHover = False opt.EnsureCleanSession = False opt.IntroduceInstabilityByIgnoringProtectedModeSettings = False 'True opt.UnexpectedAlertBehavior = IE.InternetExplorerUnexpectedAlertBehavior.Ignore Dim ieService As IE.InternetExplorerDriverService = IE.InternetExplorerDriverService.CreateDefaultService(appPath) ieService.HideCommandPromptWindow = True Dim ieObj As New IE.InternetExplorerDriver(ieService, opt) return ieObj
Here is the full trace file: https://drive.google.com/file/d/0B01W44Mcuj-PQmtPdVNkNUNIZ2M/view?usp=sharing
I think these lines from the trace show why it is failing: D 2015-09-02 12:00:10:411 command.cc(36) Raw JSON command: { "name" : "switchToWindow", "locator" : { "sessionid" : "1fecf44f-2fb9-4226-9e00-bf8565ff204f" }, "parameters" : {"name":"2a643b5c-5105-4788-a095-499bbc84a8be"} } T 2015-09-02 12:00:10:411 IECommandExecutor.cpp(173) Entering IECommandExecutor::OnExecCommand T 2015-09-02 12:00:10:411 IESession.cpp(236) Beginning wait for response length to be not zero T 2015-09-02 12:00:10:411 IECommandExecutor.cpp(474) Entering IECommandExecutor::DispatchCommand T 2015-09-02 12:00:10:411 IECommandExecutor.cpp(590) Entering IECommandExecutor::GetCurrentBrowser T 2015-09-02 12:00:10:411 IECommandExecutor.cpp(596) Entering IECommandExecutor::GetManagedBrowser T 2015-09-02 12:00:10:411 IECommandExecutor.cpp(546) Entering IECommandExecutor::IsAlertActive T 2015-09-02 12:00:10:411 Browser.cpp(697) Entering Browser::GetActiveDialogWindowHandle T 2015-09-02 12:00:10:411 Browser.cpp(195) Entering Browser::GetContentWindowHandle D 2015-09-02 12:00:10:412 IECommandExecutor.cpp(560) No alert handle is found T 2015-09-02 12:00:10:412 IECommandExecutor.cpp(620) Entering IECommandExecutor::GetManagedBrowserHandles T 2015-09-02 12:00:10:412 Browser.cpp(414) Entering Browser::IsValidWindow T 2015-09-02 12:00:10:412 Browser.cpp(697) Entering Browser::GetActiveDialogWindowHandle T 2015-09-02 12:00:10:412 Browser.cpp(195) Entering Browser::GetContentWindowHandle T 2015-09-02 12:00:10:412 Browser.cpp(414) Entering Browser::IsValidWindow T 2015-09-02 12:00:10:412 Browser.cpp(697) Entering Browser::GetActiveDialogWindowHandle T 2015-09-02 12:00:10:412 Browser.cpp(195) Entering Browser::GetContentWindowHandle T 2015-09-02 12:00:10:412 IECommandExecutor.cpp(596) Entering IECommandExecutor::GetManagedBrowser T 2015-09-02 12:00:10:412 Browser.cpp(221) Entering Browser::GetWindowName W 2015-09-02 12:00:10:422 Browser.cpp(251) Unable to get window name, IHTMLWindow2::get_name failed or returned a NULL value T 2015-09-02 12:00:10:423 IECommandExecutor.cpp(596) Entering IECommandExecutor::GetManagedBrowser T 2015-09-02 12:00:10:423 Browser.cpp(221) Entering Browser::GetWindowName W 2015-09-02 12:00:10:433 Browser.cpp(251) Unable to get window name, IHTMLWindow2::get_name failed or returned a NULL value T 2015-09-02 12:00:10:534 IECommandExecutor.cpp(590) Entering IECommandExecutor::GetCurrentBrowser
Please, let me know if you need any more information. Thanks, Cristian
I am also facing this issue.
I performed following steps:
- Click on download link by Action click
- Execute AutoIT script to handle the download bar and save the file. After the file is downloaded and AutoIt script returns control to Selenium
- Perform WebElement click to logout.
In step 3 WebDriver is able to click on logout link but still throws following error:
Exception in thread "main" org.openqa.selenium.TimeoutException: Timed out waiting for page to load. (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 40.27 seconds Build info: version: '2.47.1', revision: 'unknown', time: '2015-07-30 11:02:44' System info: host: '###Removed#####', ip: '##Removed.##', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_65' Session ID: eb967dd4-42d5-459d-aed9-7eec4edc4395 Driver info: org.openqa.selenium.ie.InternetExplorerDriver Capabilities [{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=0, ignoreZoomSetting=false, enablePersistentHover=true, ie.ensureCleanSession=false, browserName=internet explorer, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss, version=9, pageLoadStrategy=normal, ie.usePerProcessProxy=false, cssSelectorsEnabled=true, ignoreProtectedModeSettings=false, requireWindowFocus=false, initialBrowserUrl=http://localhost:28571/, handlesAlerts=true, ie.forceCreateProcessApi=false, nativeEvents=true, browserAttachTimeout=0, ie.browserCommandLineSwitches=, takesScreenshot=true}] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595) at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:273) at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84) at com.nishant.test.IEDownload.main(IEDownload.java:33)
If I replace Action click in step 1 with WebDriver click, then download bar appears and same time out exception is thrown.
If I replace WebDriver click in step 3 with webdriver.switchTo().window(), then same time out exception is thrown. But webdriver.switchTo().defaultContent(), webdriver.getWindowHandle() and webdriver.getWindowHandles() works fine.
If after I replace WebDriver click in step 3 with Action click, then no error is thrown.
Only way I am able to continue executing my test is use Action click in step 3, quit browser and create new instance of WebDriver. After this WebDriver works fine.
OS: WIn7 Driver: InternetExplorerDriver server (64-bit) 2.47.0.0 Browser: IE9
I can confirm this problem, click() does not terminate, control never returns to Selenium. It is easily possible to manually click anywhere on the page while the test hangs, even with the download window visible. If anyone knows a workaround with current driver version, please let me know.
I've added a "fix" for this issue in fa5ac92. The reason for the apparent "hang" is that when a file is downloaded, the info bar causes the IWebBrowser2::ReadyState property to never reach a value of READYSTATE_COMPLETE. Instead, it stops updating at READYSTATE_INTERACTIVE. Thus the driver's wait algorithm would never proceed beyond waiting for this property to reach an expected value. Note that this property is separate and distinct from the DOM's document.readyState property.
The proper way to resolve the issue now is to set the pageLoadStrategy capability to the value of "eager". In the .NET bindings at least, this can be done by setting the value of InternetExplorerOptions.PageLoadStrategy to InternetExplorerPageLoadStrategy.Eager. Other language bindings should consult their documentation on how to set desired capabilities for the IE driver. Furthermore, please do understand that this might have side effects on waiting for pages to load after navigation, so do take care to make sure you are properly waiting for elements on the resulting page.
The fix is available in IEDriverServer.exe version 2.53.0.1. As described in the version number strategy documented in the change log, this indicates that the change has been checked into the source tree, but not publicly distributed via any release mechanisms. This is intentional, and the change will be more widely released once a sufficient number of other fixes have been bundled together to warrant a new release. In the meantime, if you cannot wait for a new release, you can download the intermediate executable directly from the tree on Github.
Is this issue resolved? I tried to use the IEDriverServer.exe version 2.53.0.1 but still I have this kind of problem and my test case is opening an URL(not public URL local to my machine) and clicking on one of the link on the page.The page opens after the click on the link but I get the timeout exception and test fails below is the code used to initialize the webdriver:
InternetExplorerOptions options = new InternetExplorerOptions();
options.PageLoadStrategy = InternetExplorerPageLoadStrategy.Eager;
webDriver = new InternetExplorerDriver(ConfigurationManager.AppSettings["IDEServerPath"].ToString(), options, TimeSpan.FromMinutes(2));
If any one can guide me on this that will be great as I am new to the selenium.This test case works fine using firefox driver.
I just have a try with 2.53.1, the issue is resolved after made changes as below. options.PageLoadStrategy = InternetExplorerPageLoadStrategy.Eager;
I gave a try no use have you specified any other options?
I just did upgrade to selenium2.53 and IEWebDriver 2.53.1. Then made changes on below, no other actions. options.PageLoadStrategy = InternetExplorerPageLoadStrategy.Eager;
Thank you for the response.I found that our application is using kendoUI objects for designing the application which could be the reason for the above issue.Please let me know if any one have any references to solve this issue
Hi, how to make this work in java? There is no InternetExplorerDriverOptions at all. There are such for edge and chrome, but there are no for ie. I'm settings properties like this: DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); capabilities.setCapability("ie.ensureCleanSession", true);
but how do I set page load strategy in java?
InternetExplorerOptions ieOptions = new InternetExplorerOptions();
ieOptions.setPageLoadStrategy(PageLoadStrategy.EAGER);
driver = new InternetExplorerDriver(ieOptions);
It doesn't work with web driver 2. Fixed after several years in web driver 3.6 or something..