Can't get JavaScript to work?

I am trying to extract some translations from this webpage:

https://www.spanishdict.com/translate/hablar

I have code like this:
const verb = document.querySelectorAll('#dictionary-neodict-es div span')[0].innerText;

Then I have KM set like this:

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.

image


@Nige_S

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").

Again, it helps if you post your actual macro rather than an image. Instructions on how to do that can be found at How to Post/Upload your Macros and Scripts

Thank you this helped! I've got it all working