selenium - 如果满足相应条件,如何记录两条消息中的任何一条
问题描述
我的代码看起来像:
${tempclosed} ${value}= Run Keyword And Ignore Error Element Should Not Be Visible ${orderonline}
Run Keyword If '${tempclosed}' == 'TRUE' log Store is Closed on Zomato Or is Temporarily Closed Element Should Be Visible ${overview}
Sleep 3s
Run Keyword Unless '${tempclosed}' == 'FALSE' log Store is Open on Zomato
“如果在 GUI 上找到 ${tempclosed} 元素,我希望将消息记录为“Zomato 上的商店已关闭或暂时关闭”,如果未找到 ${tempclosed} 元素,则记录“Zomato 上的商店已打开” ,考虑到测试应该继续通过“
我得到的当前输出是:在这两种情况下,它都会记录第二条消息“Store is Open on Zomato”。
找到该元素时如何记录第一条消息?
解决方案
log Store is Closed on Zomato Or is Temporarily Closed Element Should Be Visible ${overview}
我认为即使您有正确的条件(通过/失败),这也不起作用,因为似乎有两个关键字和后一个关键字的参数: - Log 后面没有两个空格,或者这log Store is Closed on Zomato Or is Temporarily Closed
真的是一个关键字?- 你打算Element Should Be Visible
在ELSE
语句中执行吗?那么应该...log Store is Closed on Zomato Or is Temporarily Closed ELSE Element Should Be Visible ${overview}
推荐阅读
- ruby - tar -C 在 Chef 中失败
- c - Spectre 警告 MSVC C5040 的解决方法
- ruby-on-rails - 如何使用 RubyMine、Rails 和 Docker(远程 SDK)?
- terraform - 将字符串附加到 Terraform 中的地图类型
- ruby - 乘客-Sinatra:机架/显示异常(LoadError)
- java - 计算时差
- wordpress - Wordpress Avada:如何创建多行列
- unity3d - VS2015中的“已导入具有相同标识的多个程序集”,带有Unity生成的csproj
- javascript - javascript regex 删除空格和一个字母
- java - LDAP 引用前置库