//Create a function that returns a string, of a given lengthconstgenRand=(len)=>{returnMath.random().toString(36).substring(2,len+2);}console.log(genRand(8));//Expected output example: 4yg020wn
functionrandomString(length){var result ='';var characters ='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&*()_+=-';var charactersLength = characters.length;for(var i =0; i < length; i++){
result += characters.charAt(Math.floor(Math.random()* charactersLength));}return result;}randomString(4);
functionmakeid(length){var result ='';var characters ='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';var charactersLength = characters.length;for(var i =0; i < length; i++){
result += characters.charAt(Math.floor(Math.random()*
charactersLength));}return result;}console.log(makeid(5));
const array =[1,2,3,4,5,6,7,8,9];const string ="abcdefghijklmnopqrstuvwxyz";// random item from Arrayconsole.log(array[Math.floor(Math.random()* array.length)]);// random Char from Stringconsole.log(string[Math.floor(Math.random()* string.length)]);
functionrandom_string(strLen=8){var characters ='abcdefghijklmnopqrstuvwxyz0123456789';var result =""var charactersLength = characters.length;for(var i =0; i < strLen; i++){
result += characters.charAt(Math.floor(Math.random()* charactersLength));}return result;}
it('should add random string into input field ',async()=>{const characters ='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';functiongenerateString(length){let result =' ';const charactersLength = characters.length;for(let i =0; i < length; i++){
result += characters.charAt(Math.floor(Math.random()* charactersLength));}return result;}let input =await$('#email')await input.addValue(generateString(5))await browser.pause(4000);})