How to use a switch on the button?

@sarra.meziane1

As you can see in the selector, automationid attribute holds the name of the button. You need to create dynamic selector by passing variable into automationid attribute value.

Have a look below thread to know about passing variable into the selector.