在页面上测试是否存在jQuery UI模态对话框或替代方案

3
3个回答

4

我过去曾经做过类似的事情。

假设模态框包含在一个div中,我会从对该div进行'WaitForVisible'开始,以等待模态框真正显示出来。然后您可以按照通常的方式与元素进行交互,完成后再使用'WaitForNotVisible'。

如果没有方便的包含div,则选择模态框上的其他元素进行等待即可。


3
以下内容适用于演示JQuery UI模态对话框,网址为http://jqueryui.com/demos/dialog/
open | http://jqueryui.com/demos/dialog/
click | css=#demo-config-menu a:contains(Modal dialog)
waitForVisible | dialog-modal
assertText | ui-dialog-title-dialog-modal | Basic modal dialog
assertText | dialog-modal | Adding the modal overlay screen makes the dialog look more prominent because it dims out the page content.
click | css=.ui-dialog-titlebar-close
waitForNotVisible | dialog-modal

如果您的页面包含多个对话框,这个代码还能正常工作吗?您如何知道Selenium正在处理哪一个对话框? - Dany Y

0
<tr>
<td>waitForTextPresent</td>  
<td>Selecione os produtos para impressão</td>
<td></td>

你可以使用这个来根据标题检查对话框。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接