Hey all!
I can see that this question has been asked several times and although some answers have gotten me close, I seem to be missing something that I think more specificity and outside help may help me to solve for.
Apologies if my terminology is off at all in this post. I am by no means a developer and just opening the dev tools in my browser is a tad intimidating.
I am trying to use use the "Execute a Javascript in Front Browser" action to pull text from a webpage and copy it into a named clipboard to improve the reliability of a macro that already does this using the "Click at Found Image" action to accomplish the same thing. This is for a macro I use daily for work, so while I can't share those specific webpages, I hope the same principal will hold true for these examples. The behavior is certainly the same in that it doesn't work:
For the 2 forum posts linked below, this code gets me the title of the post when run in the browser console log.
:
document.querySelector("#topic-title > div > div > h1 > a").innerText
I am simply going into the inspect window and "Copy Selector"ing to get the "#topic-title > div > div > h1 > a"
The problem that I am running into is that when I try to run the pictured macro, nothing saves to the clipboard. I can see in the console log that it is executing the code from the macro, but I cannot for the life of me seem to get the actual text to be interpreted and saved by Keyboard Maestro. Is there something super obvious that I'm missing here? Any help would be greatly appreciated!
Note: I do have "Allow JavaScript from Apple Events" checked in Chrome. Also, when I run this on my personal machine it just fails to update the clipboard, but when I run it on my work machine it clears it and leaves it empty FWIW.