[英]Robotframework IF
我有一個for循環,並且在其中有一個If語句。 我不能正確地執行if語句。 日志說,沒有關鍵字= =可能是什么問題?
:FOR ${Line} IN @{Lines}
\ Run keyword If ${Line_Count} == 1
\ ... ${File}= BuiltIn.Catenate SEPARATOR=\n ${File} ${Line}
試試這個
:FOR ${Line} IN @{Lines}
\ ${File}= Run keyword If '${Line_Count}' == '1' BuiltIn.Catenate SEPARATOR=\n ${File} ${Line}
:FOR ${Line} IN @{Lines}
\ ${File}= Run keyword If '${Line_Count}' == '1' Catenate SEPARATOR=\n ${File} ${Line} ELSE Set Variable ${File}
說明-如果$ {Line Count}!= -1,則$ {File}將被無效,因為沒有ELSE分支可以設置其值。 因此,通過添加它並使其返回其原始值,可以解決該情況。
(您可以檢查內置的run_keyword_if()和_split_elif_or_else_branch()源中的行為)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.