browser-base
browser-base copied to clipboard
Cant find renderer containing a view instance
I would like to access the HTML structure of a given View. Views in the main process are organized by a View-Manager. I would like to access the document containing the HTML of a displayed webpage, but I don't know in what file I can request that.
You can manipulate a renderer process DOM by either using webContents.executeJavaScript or sending an IPC message to the webContents and change some HTML in the preload script.
Objective I am not trying to manipulate it, but I am trying to retrieve the DOM contained in each of the pages (tab) in the main window.
Premise As far as I understood the code, the different views are added and deleted to the main browserWindow by the ViewManager class.
What I tried
If iterate over these views and send an ipc message requesting the body of each view's document, I can only respond to that message in the view preload script, which is view-preload.ts. From there, every time I try to return the full document of the view which requested it with ipcRenderer('send-document', document.innerHTML) I am always returning the same DOM, which corresponds to the focused view's document.
Question How can I try to collect all the DOMs from every view in view-manager ( not only the current one )?