如何使用包含变量的消息验证或声明警报?
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中的警报问题
发布评论