Loop & Click through all the buttons inside a section



I have a section under which there are 4 buttons. I am able to identify all the 4 button elements and loop through them using Find Children Activity. I would like to perform a click on each of those buttons which as well i am succesfully able to do.

All of those button changes the class name after each click (which takes few seconds). I want to move my click activity to the next button on the loop only when the previous one’s class attribute is changed.

Class tag of the buttons changes from ‘btn btn-default’ to ‘btn btn-success’ after click.

Note that the no. of buttons are generated randomly but will always be under that section only due which i don’t want to identify each of those button independently and click on them.

Any suggestions would be helpful.

Thanks & Regards,
Rammohan B.