I'm probably doing something wrong. When I hit the key, nothing happens. I have the provided SpanishDict link open as the only page in Chrome. Here is my whole JS (tried both whole and just that 1 line)
What we need is your actual macro -- or enough of it to show the problem -- so we can see the options you've set on your actions.
But have a quick check of that down-arrow just to the left of the text box. If that's set to "Modern Syntax", try unchecking it for your (older style) script.
It won't display any result from your one-liner because you aren't returning any. Change the JS to
const verb = document.querySelectorAll('#dictionary-neodict-es div span')[0].innerText;
return verb;
...and you should get "hablar" displayed in a Notification.
If you don't then a) make sure you have Notifications turned on for KM, and b) make sure you've told Chrome to "Allow JavaScript from Apple Events" ("View" menu, "Developer").