Selenium IDE中的警报问题

编程入门 行业动态 更新时间:2024-10-26 02:26:34
本文介绍了Selenium IDE中的警报问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何使用包含变量的消息验证或声明警报?

How can I do to verify or assert an alert with a message that contains a variable in this text?

例如,我必须使用以下消息捕获警报:答案编号(var id_answer )成功接受。 id_answer是变量,在显示警报之前我不知道该值。例如,在控制器中(在Rails中)针对flash [:notice]命令触发此警报。我还需要使用硒命令来模拟警报窗口中的确定按钮。可能吗?

For example, I have to capture a alert with this message: Answer number (var id_answer) successfully accepted. id_answer is the variable and I don't know this value before the alert is show. This alert is triggered for a flash[:notice] command in a controller, for example (in Rails). And I need to simulate the click in the button ok inside alert window with a selenium command too. Is it possible?

任何人都可以通过Selenium IDE中完整语法命令的示例来帮助我解决这个问题?

Anyone can help me with this with a example for a complete syntax command in Selenium IDE for this problem?

推荐答案

以模拟按钮OK中的单击,您可以使用assertAlert命令-获取警报与手动单击OK具有相同的效果。如果生成了警报,但您没有将其与getAlert一起使用,则下一个Selenium操作将失败。

to simulate the click in the buton OK you could use command assertAlert - Getting an alert has the same effect as manually clicking OK. If an alert is generated but you do not consume it with getAlert, the next Selenium action will fail.

更多推荐

Selenium IDE中的警报问题

本文发布于:2023-11-27 15:50:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1638633.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   Selenium   IDE

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!