I have an element like this.
click() is a function that's only defined on HTML elements. Fortunately it's a convenience function and we can implement it ourselves pretty easily i.e.
document.getElementById('box_w').dispatchEvent(new Event('click'));
That's all the click() function does underneath the hood anyway.
Here's an example:
document.getElementById('box_w').dispatchEvent(new Event('click'));