2

我正在尝试单击从 Selenium IDE 中的另一个弹出窗口打开的弹出窗口上的按钮。我在第二个弹出窗口中运行命令没有问题,即我可以搜索并选择奖项,但是当我尝试单击“添加”按钮时没有任何反应。如果在 IDE 中记录了该步骤,则会显示以下命令:

<tr>
    <td>click</td>
    <td>//button[@type='button']</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>id=ctl00_PlaceHolderMain_New_pickerComponents_ButtonAddToTableResults</td>
    <td></td>
</tr>

但这不起作用。我也试过:

 <tr>
    <td>click</td>
    <td>xpath=//span[text()='Add']</td>
    <td></td>
</tr>

这是 HTML:

<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
<div class="ui-dialog-buttonset">
<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false">
**<span class="ui-button-text">Add</span>**
</button>
<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false">
<span class="ui-button-text">Cancel</span>
</button>
</div>
</div>

但没有快乐。我不确定为什么我可以在此弹出窗口中使用其他命令而无法单击添加按钮。

4

4 回答 4

0

据我所知,Selenium IDE 不支持多窗口。如果有可能,请尝试使用 selenium WebDriver

于 2013-07-05T13:03:03.650 回答
0

试试这个: ClickAndWait css=button:contains("Add")

于 2013-09-04T19:09:09.197 回答
0

您可以在脚本中使用以下命令,这将起作用。

driver.findElement(By.xpath("//span[contains(text(),'Add'")).click;
于 2016-06-17T13:30:40.563 回答
-1

我遇到了单击链接、打开弹出窗口并且 Selenium IDE 在弹出窗口中找不到元素的问题。我能够解决这个问题的方法是安装“隐式等待”插件。我没有“单击”链接,而是右键单击并选择“在新选项卡中打开”,这消除了弹出窗口的问题,一切对我来说都很完美。

于 2016-06-29T19:00:37.293 回答