验证Robotframework中的文本 [英] Verify text in Robotframework
问题描述
我要验证元素的文本.如何验证文本是许多字符串之一:例如:登录失败",错误登录",尝试失败" ...?
I am want to verify text of an element. How to verify text is one of many strings: Such as: "Login fail" , "Error login", "Attempt fail"... ?
*** Keywords ***
Assert Warning Message
Element Should Contain id=session_key-login-error "Login fail"
推荐答案
因此,我将创建一个包含被接受元素的列表,然后使命令列表中应包含该元素;
So I would create a list with the element that are accepted and then make a command list should contain;
示例:
@{expected_results} Create List your_1_acceptance_criteria_element your_2_acceptance_criteria_element your_3_acceptance_criteria_element
${world}= set variable your_element
List Should Contain Value @{expected_results} ${world}
名称:列表应包含值 来源:馆藏 参数:[list_ |值| msg =无]
Name:List Should Contain Value Source:Collections Arguments:[ list_ | value | msg=None ]
如果未从列表中找到该值,则失败. 如果关键字失败,则默认错误消息为不包含值".可以使用msg参数给出自定义消息.
Fails if the value is not found from list. If the keyword fails, the default error messages is does not contain value ''. A custom message can be given using the msg argument.
这篇关于验证Robotframework中的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!