What I want to do
Log all chat messages on YouTube Live Chat onto console. (Forgive me this, as I am just in the first step.)
What I'm doing
Using MutationObserver to catch changes to a mount point (const point
).
Here's my code so far.
How I'm testing
I copy and paste the above code to the console after loading a YouTube video with chat messages. (Just for reference, I'm testing on this video)
What I need help with
The code can't find the element I'm using as const point and returns null. However, if I search for the element using my browser inspector it is there. Furthermore, running the code again after having searched for it in inspector gives me my desired result. I want to know what is causing this phenomenon.