RobotFramework:如果元素不存在,则无法留下错误消息
RobotFramework: Can not leave the error message if the element is not exist
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
输出日志:
Send request with 'Proprietary Tag' field :: OK: User is able to s... | FAIL |
Element locator '//h2' did not match any elements after 5 seconds
当元素不存在时,如何 return 错误消息(示例:"There is no such element at this page")?
而不是这个:"Element locator '//h2' did not match any elements after 5 seconds"
根据文档,wait until element is enabled 接受错误消息作为参数。所以,它看起来像这样:
Wait until element is enabled ${errorCodeMessage}
... error=There is no such element on this page
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
输出日志:
Send request with 'Proprietary Tag' field :: OK: User is able to s... | FAIL |
Element locator '//h2' did not match any elements after 5 seconds
当元素不存在时,如何 return 错误消息(示例:"There is no such element at this page")?
而不是这个:"Element locator '//h2' did not match any elements after 5 seconds"
根据文档,wait until element is enabled 接受错误消息作为参数。所以,它看起来像这样:
Wait until element is enabled ${errorCodeMessage}
... error=There is no such element on this page