By default the runtime runs in a Web Worker so there is not direct access to the DOM.
If it's a small and simple amount of JS code, it might be better just to use the JS coding feature (which switches to DOM mode by default).
I need to create a plugin, even it's can be done in js for a few line