link icon
Ask The Community

How to randomize characters/numbers in transaction script

I am looking to randomize characters and numbers in order to create unique accounts for every test. How could I possibly do this? Thanks in advance


  • Karlen
    Karlen Posts: 76 Staff

    Hi QLinkwireless

    Thanks for using Web Monitoring!

    To randomize characters and numbers you can use storeEval or run Script  commands, Here is an example on how to generate random text
    var allowedChars = "abcdefghiklmnopqrstuvwxyz";
     var stringLength = 6;
     var randomstring = '';
     {    var rnum = Math.floor(Math.random() * allowedChars.length);    randomstring += allowedChars.substring(rnum,rnum+1);}
    randomstring = "SOME_TEXT" + randomstring;

    Hope this will be helpful!


    Product Owner, Remote Management services
Sign In or Register to comment.

Howdy, Stranger!
