Selenium IDE 中的警报问题
我该如何验证或断言包含以下消息的警报 文本中的变量?
例如,我必须捕获包含以下消息的警报:应答号码 (var id_answer
)已成功接受。 id_answer 是变量,在显示警报之前我不知道这个值。例如,控制器(在 Rails 中)中的 flash[:notice] 命令会触发此警报。我还需要使用 selenium 命令模拟单击警报窗口内的“确定”按钮。是否可以?
任何人都可以通过 Selenium IDE 中完整语法命令的示例来帮助我解决此问题吗?
How can I do to verify or assert an alert with a message that contains
a variable in this text?
For example, I have to capture a alert with this message: Answer number (varid_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?
Anyone can help me with this with a example for a complete syntax command in Selenium IDE for this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要模拟单击“确定”按钮,您可以使用命令“assertAlert - 获取警报”与手动单击“确定”具有相同的效果。如果生成了警报但您没有使用 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.
您可以使用 getAlert :
“检索在上一个操作期间生成的 JavaScript 警报的消息,如果没有警报,则失败。”
You could use getAlert:
"Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts."