【发布时间】:2019-01-23 03:08:03
【问题描述】:
但是当我当时在变量中传递字符串值时,我得到了错误
代码:
type(${value}).__name__
错误:
Evaluating expression 'type(Robot).__name__' failed: NameError: name 'Robot' is not defined
字符串值转换为变量
请帮帮我。
【问题讨论】:
但是当我当时在变量中传递字符串值时,我得到了错误
代码:
type(${value}).__name__
错误:
Evaluating expression 'type(Robot).__name__' failed: NameError: name 'Robot' is not defined
字符串值转换为变量
请帮帮我。
【问题讨论】:
您应该删除value 周围的括号{},只留下$value。
更新评论: Robotframework 将所有内容都视为字符串,除非您将其显式转换为其他数据类型。
${value_str} Set Variable 4
${value_number} Convert To Number ${value_str}
${type1} Evaluate type($value_str).__name__
${type2} Evaluate type($value_number).__name__
Log ${type1}
Log ${type2}
【讨论】: