cancel
Showing results for 
Search instead for 
Did you mean: 

How i can select a random element from a list in Desktop application

SOLVED
Highlighted
New Contributor

How i can select a random element from a list in Desktop application

Hi everybody,

 

I want to select a random element in a list with testcomplete in desktop application but i don't know how to make this,

Someone can help me please ?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Leader

Re: How i can select a random element from a list in Desktop application

Hi,

In my opinion everything depends on the function that selects a random element.

The algorithm can look like this:
1. read all grids values
2. add them to e.g. an array
3. use the function to select a random element from the table
4. click on the -> item to search again in the object

The 'random' function in JS:

https://stackoverflow.com/questions/5915096/get-a-random-item-from-a-javascript-array

View solution in original post

4 REPLIES 4
Highlighted
New Contributor

Re: How i can select a random element from a list in Desktop application

I put an example of list in attachment, i can click on all the 10 elements how can i select a random one in my automatic test

 

Thanks a lot

Highlighted
Community Hero

Re: How i can select a random element from a list in Desktop application

https://support.smartbear.com/testcomplete/docs/reference/language/delphiscript/routines/math/random...

 

Why do you need it to be a random selection?  Why not just go through each element in order?

 

Highlighted
Community Leader

Re: How i can select a random element from a list in Desktop application

Hi,

In my opinion everything depends on the function that selects a random element.

The algorithm can look like this:
1. read all grids values
2. add them to e.g. an array
3. use the function to select a random element from the table
4. click on the -> item to search again in the object

The 'random' function in JS:

https://stackoverflow.com/questions/5915096/get-a-random-item-from-a-javascript-array

View solution in original post

Highlighted
Community Manager

Re: How i can select a random element from a list in Desktop application

Wamboo, Marsha, thank you for suggestions!

@Mounirb31 Please let us know how you managed to solve this!


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors