简体   繁体   English

如何在 Robot Framework 中使用 Execute Javascript new Date().toLocaleDateString() 将 output 存储到变量中?

[英]How to store output to a variable using Execute Javascript new Date().toLocaleDateString() in Robot Framework?

I am using Robot Framework and I want to capture the date that is generated by this method:我正在使用 Robot Framework,我想捕获由此方法生成的日期:

Execute Javascript  new Date().toLocaleDateString()

If I do something like the below the trace log file reflects ${result} = none .如果我执行类似下面的操作,跟踪日志文件会反映${result} = none I expect the output to be ${result} = current date我希望 output 为${result} = current date

${result} = Execute JavaScript  Date().toLocaleDateString()

Missing the return function.缺少return function。

${result}=    Execute JavaScript    ldate = Date().toLocaleString();    return ldate;

EDIT: Changed code to return an object.编辑:更改代码以返回 object。

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

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