【发布时间】:2022-12-29 02:31:49
【问题描述】:
我有一个功能正常的 Robot Framework 测试,用于检查页面上的不同文本。这是非常基本的。扫描页面以查找特定字符串,然后在找到该字符串时记录通过/失败。这是我的代码。
Test Keyword
${p1}= Run Keyword And Return Status Page Should Contain Element xpath=//*[contains(text(), "A")]
Run Keyword If ${p1} Log To Console "(A) Present" ELSE Log To Console "(A) Not Present"
${p2}= Run Keyword And Return Status Page Should Contain Element xpath=//*[contains(text(), "B")]
Run Keyword If ${p2} Log To Console "(B) Present" ELSE Log To Console "(B) Not Present"
${p3}= Run Keyword And Return Status Page Should Contain Element xpath=//*[contains(text(), "C")]
Run Keyword If ${p3} Log To Console "(C) Present" ELSE Log To Console "(C) Not Present"
这运行得很好,但我无法将其放入列表中。或者也许是一个数组?我不确定。
我是否在列表中创建 xpaths 变量?我是否可以将 Run Keyword If 语句作为自己的关键字然后传递它们?我不确定。请让我知道我哪里出错了。谢谢!
【问题讨论】:
标签: automation automated-tests robotframework