Google Docs – programmatically send mouse click to an item in outline pane

In Google Docs you can open outline pane and see all headers in the document, you can also click on an header and the view will scroll to header.

My question is how simulate mouse click programmatically with JS in Chrome extention, to scroll the view to the desired header?

I tryed following code but nothing hapend:

// usage: eventFire(document.getElementById('mytest1'), 'click');
function eventFire(el, etype) {
    if (el.fireEvent) {
        el.fireEvent('on' + etype);
    } else {
        var evObj = document.createEvent('Events');
        evObj.initEvent(etype, true, false);
        el.dispatchEvent(evObj);
    }
}

The headers is an div elements with class="navigation-item-content navigation-item-level-2", When I look in chrome dev tools > event listeners, these elements do not have any event listeners.

Set selection in Google Docs from Chrome extension?

Would it be possible, from a Chrome extension, to select some text in a Google Docs document.
Specifically, I have the position of the caret, and want to select from a number of characters before that, to a number of characters after.

Update Google Docs content from Chrome Extension

I want to integrate my Chrome extension with Google Docs, as to make it able to replace text. If I just replace text by working with DOM, it has no effect. This could be helpful in many situations. One such use case is the autocorrect extension. My understanding is that Google Docs code is written in ClosureScript or something like this.

Finding text inside the editor is not too complicated. It is marked with kix classes such as kix-appview-editor and similar.
How could I trigger an update from inside the JavaScript extension script? I don’t want to use Google App Script. I know that what I need is possible, because I found an extension changing text inside GDocs from JavaScript. The extension is called Blaze Text and it has no problem working with Google Docs. Unfortunately, the code is obfuscated so determining how they do this is not easy.

I found a trick that does this for React 15 and later. I am using it to for React.JS compatibility. How could I “force an update” on Google Docs?