机器人框架中的警报处理

问题描述 投票:0回答:1

我必须处理一个弹出窗口的 2 条警报消息,但它只验证一条警报。请参考下面的屏幕截图。 enter image description here

代码选项1:

Handle Alert    * Country Description is required.* Currency is required.  Leave  
sleep  2
Handle Alert    ACCEPT

代码:选项2:

Alert Should Be Present        * Country Description is required. LEAVE
Alert Should Be Present        * Currency is required.        LEAVE
Handle Alert    ACCEPT

我尝试了这两个选项,但它不起作用

selenium-webdriver robotframework
1个回答
0
投票

1。您可以在一行中使用它,如

Alert Should Be Present   <Whole text of your alert here>

2。或者,如果您第一次不确定如何从警报中提取预期文本,您可以在执行后从测试报告中获取它并复制预期消息/例如从 ${actual_message} 变量复制:

${actual_message} =  Handle Alert   LEAVE   # Leave alert open and get its message.
Should be equal  ${actual_message}   * Country Descript...blah-blah

处理警报文档

© www.soinside.com 2019 - 2024. All rights reserved.