Forum Discussion

sundevils22's avatar
sundevils22
Occasional Contributor
12 years ago

Wild card character or a variable in the Full name of the testcomplete object

Hi



I have a list of buttons on the page which i need to click randomly .



The ful name of the buttons dffers only at the index ....can i use a wild card character or a variable in place of the index to generate the random clicking of the button.



Thanks

Gopal

1 Reply


  • Hi Gopal,


     


    You can get a random value of the index and click the button. The following sample clicks any button whose index is 0 - 10.




    function Test()


    {


      var randomIndex = Math.floor((Math.random()*10)+1);


      panel.button("Name", randomIndex).Click();


    }