1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| mainWindow.webContents.on('dom-ready', () => { mainWindow.webContents .executeJavaScript( ` const waitForExternal = setInterval(() => { if (document.querySelector('.btn')){ clearInterval(waitForExternal); console.log(11111); }else{ console.log('no'); } }, 100); `, false, (result) => console.log('webContents exec callback: ' + result) ) .then((result) => console.log('webContents exec then: ' + result) ); });
|