1

我正在尝试使用 selenium IDE 创建一些 Web 测试。但是当我点击一个打开一个新标签的javascript链接时,我遇到了一个问题。我需要在这个新选项卡上执行一些检查,但我无法让他关注仍在主页上的焦点。我尝试了几件我在谷歌上搜索但没有成功的事情。我希望有人能帮助我。

提前致谢。

更新:

所以我尝试了几件事,我觉得我的方式很好。

我可以通过以下方式获取 Windows 名称:

StoreAllWindowNames 名称 echo names=${name}

我有类似的东西:
,987dfg4545sdfgsd

似乎“,”之前的值是NULL,所以默认页面,另一个值是我页面的名称。

但我无法用 selectWindow 打开它。

有人知道我该怎么做吗?

提前致谢。

有关我的硒测试的更多信息:

<tr>
    <td>setSpeed</td>
    <td>1000</td>
    <td></td>
</tr>
<tr>
        <td>selectWindow</td>
    <td>null</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>link=Show Tree...</td>
    <td></td>
    </tr>
    <tr>
    <td>storeAllWindowNames</td>
    <td>names</td>
    <td>array</td>
</tr>
<tr>
    <td>echo</td>
    <td>${names}</td>
    <td></td>
</tr>
<tr>
    <td>waitForPopUp</td>
    <td>${names}</td>
    <td>30000</td>
</tr>
<tr>
    <td>selectWindow</td>
    <td>name=${names}</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>link=Search</td>
    <td></td>
</tr>

结果:

* [info] Executing: |setSpeed | 1000 | |
* [info] Executing: |selectWindow | null | |
* [info] Executing: |click | link=Show Tree... | |
* [info] Executing: |storeAllWindowNames | names | array |
* [info] Executing: |echo | ${names} | |
* [info] echo: ,bdae1e119a367a54
* [info] Executing: |waitForPopUp | ${names} | 30000 |
* [error] Timed out after 30000ms
* [info] Executing: |selectWindow | name=${names} | |
* [error] Window does not exist. If this looks like a Selenium bug, make sure to read http://seleniumhq.org/docs/04_selenese_commands.html#alerts-popups-and-multiple-windows for potential workarounds. 

其中 bdae1e119a367a54 是我想要获得的动态值。

我找到了一个有人做过的机器,但它对我不起作用它返回 null

http://old.nabble.com/How-can-I-access-the-second,-third..-element-of-a-stored-array--td9393201.html

4

2 回答 2

0

试试这个

click              link=Show Tree...
pause              5000
selectWindow       name=${names}
windowFocus
click              link=Search

或者

storeEval | this.browserbot.findElement('link=Show Tree...').href | myUrl |
open | ${myUrl} ||

或者

disable the tab feature setting in browser to work with multi-window.
于 2012-03-22T05:26:17.127 回答
0

该功能是否有效可能取决于您驾驶的浏览器。

我建议您尝试使用其他浏览器。

于 2012-03-22T02:15:07.067 回答