Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

213
Views
Can Electron read DOM from BrowserView?

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();
};```
about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!