“Run Keyword If” and setting a variable

前端 未结 2 1224
不思量自难忘°
不思量自难忘° 2021-01-06 02:57

The following code doesn\'t work. I want to set a variable if a condition is true.

    Run Keyword If    ${MAC} == 110299160221421    ${device_serial}=    se         


        
2条回答
  •  梦毁少年i
    2021-01-06 03:23

    Run keyword if returns the result of the keyword that you're running. So, like with any other keyword, you put a variable in the first column if you want to save the value:

    ${device_serial}=  run keyword if  ${MAC} == 110299160221421  
    ...    set variable    ${device_serial_1}
    

    I this specific case you might want to use Set Variable If instead of Run Keyword If

    ${device_serial}=  set variable if  ${MAC} == 110299160221421
    ...    ${device_serial_1}
    

提交回复
热议问题