验证文本对象或处理在机器人框架中并非在所有情况下都出现的对象
Validation of text objects or handling on objects that dont appear in all cases in robot framework
我必须在登录应用程序后验证页面文本,
文本/该页面不会每次都出现,但如果该页面出现,那么我必须执行一些操作,如果它没有出现,那么我必须继续。
我尝试了以下方法:
1.
Run Keyword If Page Should Contain ${txt_HomePage} Login Successful
Else Login Unsuccessful
Login Successful
Log Successfully logged into application
Login Unsucessful
Log Please verify userid and password
${Result}= Page Should Contain ${txt_HomePage}
Run Keyword Unless '${RESULT}'=='PASS' Log Unsucessfull
两种情况都失败了,还有其他建议吗?如何处理在所有情况下都不会出现的对象
当需要测试一个行为不总是相同的系统时,Robot Framework 不是很优雅。您可以使用 RF Run Keyword And Ignore Error
获取 pass/fail 并进行处理:
${status} ${message}= Run Keyword And Ignore Error Page Should Contain ${txt_HomePage}
IF "${status}" == "PASS"
Log Successfully logged into application
ELSE
Log Please verify userid and password
END
我必须在登录应用程序后验证页面文本, 文本/该页面不会每次都出现,但如果该页面出现,那么我必须执行一些操作,如果它没有出现,那么我必须继续。
我尝试了以下方法: 1.
Run Keyword If Page Should Contain ${txt_HomePage} Login Successful
Else Login Unsuccessful
Login Successful
Log Successfully logged into application
Login Unsucessful
Log Please verify userid and password
${Result}= Page Should Contain ${txt_HomePage}
Run Keyword Unless '${RESULT}'=='PASS' Log Unsucessfull
两种情况都失败了,还有其他建议吗?如何处理在所有情况下都不会出现的对象
当需要测试一个行为不总是相同的系统时,Robot Framework 不是很优雅。您可以使用 RF Run Keyword And Ignore Error
获取 pass/fail 并进行处理:
${status} ${message}= Run Keyword And Ignore Error Page Should Contain ${txt_HomePage}
IF "${status}" == "PASS"
Log Successfully logged into application
ELSE
Log Please verify userid and password
END