Electron File Upload

The Electron File Upload Block in Leapwork enables automated file uploads in Electron-based applications by simulating user interactions with file selection dialogs. This block enhances test automation by allowing dynamic file selection, eliminating the need for manual intervention. 

When fully expanded, the following is an example of the Electron File Upload block:

electron-file-upload

The Electron Upload File block header

The left green input connector in the header is used to trigger the block execution.

The right green output connector in the header is triggered once the file has been successfully uploaded. This allows subsequent blocks in the automation flow to continue execution only after the upload is complete.

The block title Electron File Upload can be changed by double-clicking on it and typing a new title.

File input

Note: This feature is available starting from Release 2025.1.173

The File Input property allows the Electron File Upload Block to receive a file from any other block within the automation flow. If the received file is missing or invalid, the block will return an error and stop execution.

Source type

Choose between:

Data File: A file to be uploaded that will be saved to Leapwork

Local Path: A file to be uploaded that will refer to the path specified

Found element

This property contains the found Electron element in the application window. This can be used as the source element in other building blocks, for instance to narrow down searches for elements such as table cells.

Not found

This green output connector triggers if the Electron element is not found before the timeout (see below). This is typically used to branch the execution flow or to explicitly fail a case by linking it to a Fail block.

Source element

You can choose to either define the source or select the “Element” option. By doing the latter, the Electron element locator will be limited to only work inside the source element.

Electron window

Once an Electron window is found and the focus is set, this property contains a handle to the window. This can be used in cases where multiple windows are open during when running a test in order to direct other building blocks to use a specific window.

Use occurrence

Select which occurrence of the Electron element to use, if more than one is found. Select “All” to iterate through all of the occurrences.

Count

This property contains the total number of found Electron elements that match the locator set above.

Default timeout

If the 'Default Timeout' property checkbox is not selected, then the timeout value will be set to 10 seconds unless changed manually. If the 'Default Timeout' property checkbox is selected, then the 'Default timeout' value selected in the flow settings (under “Max. run time”) will be applied.

Scroll to find

When a value other than “None” is selected, the building block will use scrolling when searching for the Electron element.

Await DOM change

Delay the search for the Electron element until there has been no changes to the application’s DOM for a specified period of time (e.g., three seconds).

This is useful when waiting for behind-the-scenes updates in javascript to occur. Regardless of this checkbox, the search and click will occur after waiting a maximum of 30 seconds.

Await Requests

Delay the search for the Electron element until there has been no active XHR requests for a specific period of time (e.g., three seconds).

Regardless of this checkbox, the search and click will occur after waiting a maximum of 30 seconds.