In my case, it worked in the past, but something changed and it stopped working. The other suggestions didn't help, but I got it to work doing the following. If you're doing it for the first time you might have success starting at step 4.
- Open System Preferences > Privacy & Security > Accessibility
- Remove Automator by selecting it and then clicking the - button below the list.
- Close System Preferences to commit changes
- Run the Automator workflow from inside Automator
- Tricky Part: The permissions notification appears behind the Automator window, probably because Automator complains it doesn't have the permissions after the System notification appears. So just move the Automator window out of the way, and you should see the Security Permissions window, and click Open System Preferences
- Turn on permissions for Automator in Accessibility.
This is on an Intel-based Mac Mini 2018 running macOS Ventura 13.6.1