简体   繁体   中英

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:

Execute Javascript  new Date().toLocaleDateString()

If I do something like the below the trace log file reflects ${result} = none . I expect the output to be ${result} = current date

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

Missing the return function.

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

EDIT: Changed code to return an object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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