Showing the cursor for headless browser

This commit is contained in:
Mohammad Fares
2022-09-07 17:19:07 +02:00
parent 5118105ffc
commit 53719a17cc
4 changed files with 7 additions and 3 deletions

View File

@@ -71,6 +71,8 @@ ipcMain.handle('getOptions', function () {
* @param {Object} event
*/
ipcMain.handle('capturePage', async function (event, captureRect, frameIndex) {
// To show the cursor for headless browser
mainWindow.focusOnWebView();
const img = await mainWindow.webContents.capturePage(captureRect);
const outputPath = path.join(renderDir, frameIndex + '.png');
fs.writeFileSync(outputPath, img.toPNG());

View File

@@ -8,7 +8,6 @@ contextBridge.exposeInMainWorld('app', {
return ipcRenderer.invoke('getOptions');
},
capturePage(captureRect, frameIndex) {
console.log('prelaod > capturePage');
return ipcRenderer.invoke('capturePage', captureRect, frameIndex);
},
});