使用Selenium处理浏览器弹出窗口

bra*_*zoo 20 selenium internet-explorer popup regression-testing

我们针对现有代码库运行Selenium回归测试,我们的Web应用程序中的某些屏幕使用弹出窗口进行中间步骤.

目前我们在测试中使用命令:

// force new window to open at this point - so we can select it later
selenium().getEval("this.browserbot.getCurrentWindow().open('', 'enquiryPopup')");
selenium().click("//input[@value='Submit']");
selenium().waitForPopUp("enquiryPopup", getWaitTime());
selenium().selectWindow("enquiryPopup");
Run Code Online (Sandbox Code Playgroud)

...... 大部分时间都有效.偶尔测试将失败在waitForPopUp()与线

com.thoughtworks.selenium.SeleniumException: Permission denied
Run Code Online (Sandbox Code Playgroud)

任何人都可以提出更好,更可靠的方法吗?

此外,我们主要在IE6和7上运行这些测试.

bra*_*iel 4

有用!!只是为了让那些喜欢 Selenese 的人更容易。

这对我使用 IE7(正常模式)有用。

真是个麻烦事。感谢天空中的意大利面怪物,否则我不可能在 IE 中运行它。

<tr>
    <td>getEval</td>
    <td>selenium.browserbot.getCurrentWindow().open('', 'windowName');</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>buttonName</td>
    <td></td>
</tr>
<tr>
    <td>windowFocus</td>
    <td>windowName</td>
    <td></td>
</tr>
<tr>
    <td>waitForPopUp</td>
    <td>windowName</td>
    <td>3000</td>
</tr>
<tr>
    <td>selectWindow</td>
    <td>windowName</td>
    <td></td>
</tr>
Run Code Online (Sandbox Code Playgroud)