Instead of relying on button clicks, you can send requests directly. Capture the request in the developer tools of your browser and implement it in your application
Aside from that, you can use XPath to create complex matching patterns for finding your buttons. Match other things instead of just the ID-Tag. CSS-Classes, different additonal attributes, location in the DOM, etc.