Selenium IDE中的警报问题 [英] Problem with Alert in the Selenium IDE

查看:139
本文介绍了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中的警报问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆