Forum Discussion

tarleaa's avatar
tarleaa
Contributor
15 years ago

Using functions in KeywordTest

Hello,



how can I return the value of a function to a text box using Keyword Testing?



For example, I have the following function written in javascript that returns a random username :



function random_username()

{

var currentTime = new Date();

var hour = currentTime.getHours();

var min = currentTime.getMinutes();

var sec = currentTime.getSeconds();

var day = currentTime.getDate();

var month = currentTime.getMonth() + 1;

return 'Monthly' + month + day + '_' + hour + min + sec;

}




and I want the returning value to be typed in a textbox from a recorded KeywordTest (see attached image).



Thank you,

Andrei

1 Reply

  • Hi Andrei,



    You need to use the Run Script Routine operation (see the "Run Script Routine Operation" help topic).