From 53719a17cc280ce1a01a6a755a40b58bcc858e9b Mon Sep 17 00:00:00 2001 From: Mohammad Fares Date: Wed, 7 Sep 2022 17:19:07 +0200 Subject: [PATCH] Showing the cursor for headless browser --- .gitignore | 5 ++++- README.md | 2 +- render/index.js | 2 ++ render/preload.js | 1 - 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 51e8b80..43786b1 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,7 @@ render/dist # Private assets demo -logo \ No newline at end of file +logo + +# Others +.DS_Store diff --git a/README.md b/README.md index ba5dd1b..4d53dac 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ npm install -g terminalizer > Still facing an issue? Check the [Issues](#issues) section or open a new issue. -The installation should be very smooth with Node.js v4-v12. For newer versions, if the installation is failed, you may need to install the development tools to build the `C++` add-ons. Check [node-gyp](https://github.com/nodejs/node-gyp#installation). +The installation should be very smooth with Node.js v4-v16. For newer versions, if the installation is failed, you may need to install the development tools to build the `C++` add-ons. Check [node-gyp](https://github.com/nodejs/node-gyp#installation). # Getting Started diff --git a/render/index.js b/render/index.js index 9895d5c..86eb042 100644 --- a/render/index.js +++ b/render/index.js @@ -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()); diff --git a/render/preload.js b/render/preload.js index e47939f..f35a6d7 100644 --- a/render/preload.js +++ b/render/preload.js @@ -8,7 +8,6 @@ contextBridge.exposeInMainWorld('app', { return ipcRenderer.invoke('getOptions'); }, capturePage(captureRect, frameIndex) { - console.log('prelaod > capturePage'); return ipcRenderer.invoke('capturePage', captureRect, frameIndex); }, });