teamviewer.com link icon
or
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

Comments

  • 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 = '';
     for (var i=0; i<stringLength; i++)
     {    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!

It looks like you're new here. If you want to get involved, click one of these buttons!