is it possible to read DOM of website with given url in BrowserView? I have code that looks like this one, and Electron is throwing an error: "An object could not be cloned"
// Create the browser window.
const mainWindow = new BrowserWindow({
height: 800,
width: 1200,
webPreferences: {
preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY,
},
});
const view = new BrowserView({
webPreferences: {
webSecurity: false,
allowRunningInsecureContent: true,
},
});
mainWindow.setBrowserView(view);
view.setBounds({ x: 200, y: 0, width: 900, height: 800 });
view.webContents.loadURL("https://electronjs.org");
view.setAutoResize({ width: true, height: true });
view.webContents
.executeJavaScript("document.querySelector('body')")
.then((result) => {
console.log("html", result);
})
.catch((err) => console.log(err));
// and load the index.html of the app.
mainWindow.loadURL(MAIN_WINDOW_WEBPACK_ENTRY);
// Open the DevTools.
mainWindow.webContents.openDevTools();
};```