关闭窗口后出现NoSuchWindowException

关闭窗口后出现NoSuchWindowException

本文介绍了关闭窗口后出现NoSuchWindowException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Selenium2Library中使用robotframework.而且我在处理IE8中的弹出窗口时遇到了一些麻烦.

I'm using robotframework with the Selenium2Library.And i've been having some trouble on handling popup windows in IE8.

Try Popup
    Open Browser To PageXYZ
    Click Element  XYZ
    Select Window name=POPUPXYZ
    Page Should Contain  X
    Page Should Contain  Y
    Page Should Contain  Z
    Close Window
    Get Window Identifiers

关闭窗口"失败后,我使用的任何命令都会得到相同的异常NoSuchWindowException.

Any command I use after the 'Close Window' fails and i get the same exception NoSuchWindowException.

(获取窗口"命令IMO不应发生这种情况)

(That shouldn't happen for the Get Window command IMO)

有帮助吗?

Ty

推荐答案

我同意您的看法,即不会发生,但确实会发生.从我所看到的情况来看,WebDriver似乎需要冷静期(Sleeps将消除错误).作为一种解决方法,我将等待关键字成功与Selenium2Library关键字结合使用,该关键字应该在我继续测试之前通过.

I agree with you that it should not happen but it does.From what I have seen, it is as if WebDriver needs a cool-off period (Sleeps will get rid of the error). As a workaround I use Wait Until Keyword Succeeds in combination with a Selenium2Library keyword that should pass before I resume testing.

这篇关于关闭窗口后出现NoSuchWindowException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 16:11