Trying to click a button in safari
I would recommend trying Keyboard Maestro.

It has a built-in feature to "Click Safari Link" or "Click Google Chrome Link" and also has a feature to click buttons too.

If you can link to an example page, I can give more specific advice.