Electron Recording Basics
CukeTest's recording function can also be used for Electron application recording by directly selecting the Electron type in the Recording Settings panel. The following two Electron recordings can be applied.
- Applications developed with Electron: Enter the full path of the target
.exe
application in theElectron Application
column; usually the size of the.exe
file of the main process of the Electron application is over 100MB. - Pages opened by Electron: enter the full path to
electron.exe
in theElectron application
field (you can install it bynpm -i -g electron
if you don't have it) and the link to the page to be opened as the first value of thecommand line argument
.
Recording limitations
One limitation of the current Electron application recording is that it does not record off-page operations. Because the recording is only for Web pages, which is the main interface in Electron, and outside the main interface, such as menus, file selectors, dialog boxes, etc., it is impossible to generate code in Electron recording. These operations can be made up by switching to Windows Automation Recording.
CukeTest itself is also an Electron application, meaning that you can generate automation scripts by recording CukeTest.
For example, the following is a script for recording a simple operation of CukeTest:
const { _electron: electron } = require('leanpro.web');
(async () => {
const browser = await electron.launch({
args: [""],
executablePath: "C:\\Program Files\\LeanPro\\CukeTest\\Cuke.exe",
timeout: 20000
});
// Open new page
const window = await app.firstWindow();
// Click text=qt-table
await page.click('text=qt-table');
// Click text=添加新场景
await page.click('text=添加新场景');
// Click div[role="toolbar"] span span
await page.click('div[role="toolbar"] span span');
// Click text=definitions1.js
await page.click('text=definitions1.js');
// Click #sortable0 >> text=>
await page.click('#sortable0 >> text=>');
// ---------------------
await app.close();
})();