简体   繁体   English

在IE 11中关闭模式对话框窗口后,切换到父窗口时,Selenium Web驱动程序会超时

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

I have web page when I click on a link it opens a modal dialog (Dialog A) and when I click on a button in 'Dialog A' it opens another modal dialog (Dialog B) after doing some operation on 'Dialog B' I'm saving and closing the 'Dialog B' to switch to 'Dialog A' this is where I'm getting the below web driver exception. 我有网页,当我单击链接时,它会打开一个模态对话框(对话框A),当我单击“对话框A”中的按钮时,在对“对话框B”进行某些操作后,它会打开另一个模态对话框(对话框B)。 '保存并关闭'对话框B'以切换到'对话框A',这是我收到以下Web驱动程序异常的地方。 'Dialog B' is getting closed successfully issue is occurring when switching to 'Dialog A'. 切换到“对话框A”时,“对话框B”成功关闭。

Below is the exception that I'm getting: 以下是我得到的例外:

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: 

I have tried closing the modal dialog window using below methods and tried switching to its parent but still no luck. 我尝试使用以下方法关闭模式对话框窗口,并尝试切换到其父窗口,但仍然没有运气。

  • Closing the modal dialog by clicking on the close button and try switching to parent window – NOT WORKED 通过单击关闭按钮来关闭模式对话框,然后尝试切换到父窗口–无效
  • Executing the Java Script of the close button and try switching to parent window – NOT WORKED 执行关闭按钮的Java脚本,然后尝试切换到父窗口–无效
  • Closing the modal dialog using “window.close()” and try switching to parent window – NOT WORKED 使用“ window.close()”关闭模式对话框,然后尝试切换到父窗口–无效
  • Closing the modal dialog using IWebDriver.Close() method and try switching to parent window – NOT WORKED 使用IWebDriver.Close()方法关闭模式对话框,然后尝试切换到父窗口–无效

I'm using Selenium web driver v2.48 我正在使用Selenium Web驱动程序v2.48

Can anyone please help me on this. 谁能帮我这个忙。

As a workaround, I switched to modal dialog 'Dialog A' and used IWebDriver.Close() method to close that modal dialog which closed the modal dialog 'Dialog B' as well (since Dialog A is the parent for Dialog B). 作为一种解决方法,我切换到模式对话框“ Dialog A”,并使用IWebDriver.Close()方法关闭该模式对话框,该对话框也关闭了模式对话框“ Dialog B”(因为Dialog A是Dialog B的父级)。 By doing this web driver doesn't timed out when switching to the main web page. 通过这样做,切换到主页时,Web驱动程序不会超时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM