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

125
Views
How to perform clicks in BrowserWindow of an Electron app?

I am writing and Electron app. It has a main browser window. Then from there I open another BrowserWindow. Now I want to programmatically click on a button that is present on the child browser window. How can I achieve that ?

Let's assume that my code in the render process of the main window is as follows :

const childWindow = new BrowserWindow({
        width: 800,
        height: 600,
    })
childWindow.loadUrl('...')
// wait for the window to settle
setTimeout(()=>{
    // the code to click the button
}, 3000)


about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can make use of preloads, which are basically scripts that run inside an Electron browser window

const childWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
        preload: path.join(/* path to preload script*/),
        contextIsolation: false,
        enableRemoteModule: true
    }
})
childWindow.loadUrl('...')

// my preload script

document.addEventListener('DOMContentLoaded', () => {
    //get your element using getElementById or querySelector.. etc
    // then perform the .click() on that element
});
about 4 years ago · Juan Pablo Isaza Report
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!