简体   繁体   English

RobotFramework:如果元素不存在,则无法留下错误消息

[英]RobotFramework: Can not leave the error message if the element is not exist

robotFramework test cases: robotFramework测试案例:

verify that user can send a request and redirect to next page
    Wait until element is enabled    ${errorCodeMessage}
    Element Text Should Be    ${errorCodeMessage}    Vikailmoituksen tapahtumat

output logs: 输出日志:

Send request with 'Proprietary Tag' field :: OK: User is able to s... | FAIL |
Element locator '//h2' did not match any elements after 5 seconds

How can I return the error message(example: "There is no such element at this page") when element is not exist? 如果元素不存在,如何返回错误消息(例如:“此页面上没有这样的元素”)? Instead of this: "Element locator '//h2' did not match any elements after 5 seconds" 而不是这样: "Element locator '//h2' did not match any elements after 5 seconds"

According to the documentation, wait until element is enabled accepts an error message as an argument. 根据文档, 等待直到启用元素会接受错误消息作为参数。 So, it would look something like this: 因此,它看起来像这样:

Wait until element is enabled    ${errorCodeMessage}
...    error=There is no such element on this page 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM