Forum Discussion

kmorseprime's avatar
kmorseprime
Occasional Contributor
2 years ago

Return a string in a script

I wrote a small script in Python that generates a string of 8 digits. I am trying to set this up so that I run the script in a KeyWord test and the value gets typed in as an action.

 

For example:

1. I run the script below which generates a string which, as an example, would be "04172028" (Screenshot 1)

2. I would need to  take an action in my KeywordTest a simply would type the value of "04172028" in the application I'm testing (Screenshot 2)

 

Any ideas?

 

Screenshot 1 for Script Routine

 

Screenshot 2

 

 

 

 




  • Use Set Variable Value and calculate your date and store it in a variable. Then use that variable and the Keys action to type it in wherever you want. 

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Last Operation Result might also work if used right after script call:

     

     

  • MW_Didata's avatar
    MW_Didata
    Regular Contributor

    I don't know how it works for Python since my Project runs in VBS, but to get a value out either Write that to a Variable within the script, like this

     

    Or set var to: Last operation result

    To use last result be sure to set the Routine name = Result

    Like this