Suppose that you have the following values in dropdown. Step (1) Define all these values which are in your dropdown in an array for example. π var Reference = [ "LinkedIn" , "Facebook" , "Twitter" , "Other" , "Instagram" , "Email" , "Friends" ]; Step (2) Then define a random function for exampleπ var randreferences = Reference [ Math . floor ( Math . random () * Reference . length )]; Step (3) Call this random function in Select() method. for example π cy . get ( '#aboutUs' ). select ( randreferences ) Important Note:This code should be in same test case where you are trying to do this one Enjoy✌ Full Code ==>πππ var Reference = [ "LinkedIn" , "Facebook" , "Twitter" , "Other" , "Instagram" , "Email" , "Friends" ]; var randreferences = Reference [ Math . floor ( Math . random () * Reference . lengt
Cypress Automation Solution website is to post the issues and their best solutions to the Cypress Automation Community.