How to select an element added to the DOM dynamically?

As mentioned in the other thread, since that button is part of a shadow dom, you cannot query it directly like this, You have to first query the shadow host, then query it’s dom for the button. For example:

document.querySelector('div[data-spotim-module]').firstElementChild.shadowRoot.querySelector('.Button__primary--11-4-12')
2 Likes