Showing the cursor for headless browser
This commit is contained in:
parent
5118105ffc
commit
53719a17cc
5
.gitignore
vendored
5
.gitignore
vendored
@ -23,4 +23,7 @@ render/dist
|
|||||||
|
|
||||||
# Private assets
|
# Private assets
|
||||||
demo
|
demo
|
||||||
logo
|
logo
|
||||||
|
|
||||||
|
# Others
|
||||||
|
.DS_Store
|
||||||
|
@ -104,7 +104,7 @@ npm install -g terminalizer
|
|||||||
|
|
||||||
> Still facing an issue? Check the [Issues](#issues) section or open a new issue.
|
> 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
|
# Getting Started
|
||||||
|
|
||||||
|
@ -71,6 +71,8 @@ ipcMain.handle('getOptions', function () {
|
|||||||
* @param {Object} event
|
* @param {Object} event
|
||||||
*/
|
*/
|
||||||
ipcMain.handle('capturePage', async function (event, captureRect, frameIndex) {
|
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 img = await mainWindow.webContents.capturePage(captureRect);
|
||||||
const outputPath = path.join(renderDir, frameIndex + '.png');
|
const outputPath = path.join(renderDir, frameIndex + '.png');
|
||||||
fs.writeFileSync(outputPath, img.toPNG());
|
fs.writeFileSync(outputPath, img.toPNG());
|
||||||
|
@ -8,7 +8,6 @@ contextBridge.exposeInMainWorld('app', {
|
|||||||
return ipcRenderer.invoke('getOptions');
|
return ipcRenderer.invoke('getOptions');
|
||||||
},
|
},
|
||||||
capturePage(captureRect, frameIndex) {
|
capturePage(captureRect, frameIndex) {
|
||||||
console.log('prelaod > capturePage');
|
|
||||||
return ipcRenderer.invoke('capturePage', captureRect, frameIndex);
|
return ipcRenderer.invoke('capturePage', captureRect, frameIndex);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user