繁体   English   中英

机器人框架 - 获取当前日期问题 - 未找到名称为“=”的关键字

[英]Robot FrameWork - Get Current Date Issue - No keyword with name '=' found

我正在尝试使用当前时间更新一个 Excel 文件上的列。

为了完成它,我使用来自DateTime库的Get Current Date关键字并将其存储到下面脚本中的标量${datetime}

 *** Settings ***
 Default Tags      Download_File
 Library           SeleniumLibrary
 Library           ExcelLibrary
 Resource          Userdefinedkeywords.txt
 Library           DateTime

 Run Keyword If    ${countt}>0    Run Keywords    Click Element    xpath://[@id="fileSubmit"]/div[1]/img
    ...    AND    Open Excel    D:\\RPA\\Demo\\Excelx.xls
    ...    AND    Put String To Cell    Test    2    ${countd}    ZIP FILE
    ...    AND    Save Excel    D:\\RPA\\Demo\\Excelx_DONE.xls
    ...    ELSE IF    ${countt2}>0    Run Keywords    Click Element    xpath://*[@id="plsAttachGrid_0_1"]/img
    ...    AND    ${datetime}=    Get Current Date
    ...    AND    Open Excel    D:\\RPA\\Demo\\Excelx.xls
    ...    AND    Put String To Cell    Test    2    ${countd}    SINGLE FILE
    ...    AND    Put String To Cell    Test    3    ${countd}    ${datetime}
    ...    AND    Save Excel    D:\\RPA\\Demo\\Excelx_DONE.xls
    ...    ELSE    Run Keywords    Open Excel    D:\\RPA\\Demo\\Excelx.xls
    ...    AND    Put String To Cell    Test    2    ${countd}    NO FILE
 ${countd}=    Evaluate    ${countd}+${1}

我收到以下错误:

FAIL: No keyword with name '=' found.

当部分代码运行时:

... AND ${datetime}= Get Current Date

代码有什么问题? 提前致谢

您不能在 Run Keyword If 中进行变量赋值 - 它只运行关键字,这是框架抛出错误的原因。

Run Keyword If    ${countt}>0    Run Keywords    Click Element    xpath://[@id="fileSubmit"]/div[1]/img
# skipped lines
    ...    AND    ${datetime}=    Get Current Date
    ...    AND    # skipped lines

当它到达该行时,它尝试运行带有参数“获取当前日期”的关键字${datetime}= ,但失败了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM