首页 > 解决方案 > ${time} = 获取时间 time=NOW + 1h 2min 3s # 1h 2min 3s 添加到本地时间

问题描述

根据Robot 内置库中的Get Time 关键字

    ${time} =   Get Time    time=NOW + 1h 2min 3s   # 1h 2min 3s added to the local time

${time} 不是 YYYY-MM-DD hh:mm:ss 格式,但它具有以下值

${time} = 27

你能解释一下为什么吗?

标签: robotframeworkbuilt-in

解决方案


在关键字Get Time的 Robot Framework 文档中,提到了两个参数:

格式=时间戳,时间_=现在

如您所知,您的示例缺少_

*** Test Cases ***
Test Time
     ${time} =   Get Time    time_=NOW + 1h 2min 3s   # 1h 2min 3s added to the local time
     log to console    ${time}

导致:

INFO : ${time} = 2020-01-18 17:24:16

推荐阅读