在 IE 11 中关闭模态对话框 window 后切换到 parent window 时,Selenium Web 驱动程序超时

Selenium web driver gets timed out when switching to the parent window after closing the modal dialog window in IE 11

我有网页,当我点击 link 时它会打开一个模态对话框(对话框 A),当我点击 'Dialog A' 中的按钮时它会打开另一个模态对话框(对话框 B)在对 'Dialog B' 进行一些操作后,我正在保存并关闭 'Dialog B' 以切换到 'Dialog A' 这是我遇到以下 Web 驱动程序异常的地方。 'Dialog B' 正在成功关闭切换到 'Dialog A' 时出现问题。

下面是我得到的异常:

OpenQA.Selenium.WebDriverException was caught
HResult=-2146233088
Message=The HTTP request to the remote WebDriver server for URL   http://localhost:7067/session/4f24fcad-a867-4b0d-bf97-ab409b97ec67/window timed out after 60 seconds.
Source=WebDriver
StackTrace:
   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, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.InternalExecute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteTargetLocator.Window(String windowName)
InnerException: System.Net.WebException
   HResult=-2146233079
   Message=The operation has timed out
   Source=System
   StackTrace:
        at System.Net.HttpWebRequest.GetResponse()
        at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)
   InnerException: 

我尝试使用以下方法关闭模态对话框 window 并尝试切换到它的 parent 但仍然没有成功。

我正在使用 Selenium 网络驱动程序 v2.48

谁能帮我解决这个问题。

作为解决方法,我切换到模态对话框 'Dialog A' 并使用 IWebDriver.Close() 方法关闭模态对话框,这也关闭了模态对话框 'Dialog B'(因为对话框 A是对话框 B) 的父项。通过这样做,网络驱动程序在切换到主网页时不会超时。