I am designing a site where it would be problematic if macros were allowed to run freely.
I have thought of a way to stop a macro made by simulating the HTTP request
A button may be allways clicked programmatically. For example you may have some page with form like this:
than it is possible just to open debug cosole and type
document.getElementsByTagName('button')[0].click();
which will click the button, or
document.getElementsByTagName('input')[1].click();
which will click the submit button of the form, or just
document.forms[0].submit();
to submit the form without clicking the button.
There is no way to prevent user from mastering JavaScript code on client. You have to add some validation on server side in order to prevent unwanted user actions.