【问题标题】:Selenium web driver gets timed out when switching to the parent window after closing the modal dialog window in IE 11在 IE 11 中关闭模式对话框窗口后切换到父窗口时,Selenium Web 驱动程序超时
【发布时间】:2016-02-06 03:23:26
【问题描述】:

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

以下是我得到的例外:

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: 

我尝试使用以下方法关闭模态对话框窗口并尝试切换到其父级,但仍然没有成功。

  • 通过单击关闭按钮关闭模式对话框并尝试 切换到父窗口 - 不工作
  • 执行关闭按钮的 Java 脚本并尝试切换到 父窗口 - 不工作
  • 使用“window.close()”关闭模式对话框并尝试切换到 父窗口 - 不工作
  • 使用 IWebDriver.Close() 方法关闭模式对话框并尝试 切换到父窗口 - 不工作

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

谁能帮帮我。

【问题讨论】:

    标签: c# selenium webdriver


    【解决方案1】:

    作为一种解决方法,我切换到模式对话框“对话框 A”并使用 IWebDriver.Close() 方法关闭该模式对话框,该模式对话框也关闭了模式对话框“对话框 B”(因为对话框 A 是对话框 B 的父级) )。通过这样做,Web 驱动程序在切换到主网页时不会超时。

    【讨论】:

      猜你喜欢
      • 2012-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多