javascript - Selenium IDE - 如何处理 java 脚本警报和确认

标签 javascript selenium selenium-ide

我是自动化测试的新手,并已开始使用 Selenium IDE 作为自动化的选择。

我只想知道是否有任何方法可以使用 IDE 处理 java 脚本警报。

假设一个场景:我点击“删除”按钮,出现一个带有确定和取消选项的 java 脚本警告框,但是 Xpath 无法识别这些元素。另一方面,当我为单击删除按钮上的事件并使用 Selenium IDE 运行它,该元素将自动删除。

所以,请大家帮忙。如果我的问题需要详细说明,请留下回复。

提前致谢。

最佳答案

看看the documentation .主要部分是这样的:

When running under Selenium, JavaScript pop-ups will not appear. This is because the function calls are actually being overridden at runtime by Selenium’s own JavaScript. However, just because you cannot see the pop-up doesn’t mean you don’t have to deal with it. To handle a pop-up, you must call its assertFoo(pattern) function. If you fail to assert the presence of a pop-up your next command will be blocked and you will get an error similar to the following

[error] Error: There was an unexpected Confirmation! [Chose an option.]

A step-by-step manual is in the section about Alerts.

关于javascript - Selenium IDE - 如何处理 java 脚本警报和确认,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14788118/

相关文章:

java - 单击每个元素并执行操作时出现问题

jquery - Selenium.click 对某些 anchor 元素不起作用

javascript - 如何将 TS 模块导入或要求到 CommonJS 文件中?

javascript - 如何更新一个 Javascript 对象数组而不更新另一个

Java-Selenium 允许弹出窗口

automated-tests - 比较 Selenium IDE 中的存储值

dom - 使用 Selenium 自动点击 JavaScript 链接

javascript - 如何创建深度代理(又名代理膜)?

javascript - 我们如何使用 html 页面访问移动设备摄像头和麦克风

python - 使用 selenium 和 python 捕获 AJAX 响应