Upload File
Uploads a file to a web page using a specified <input> element selector in the web page.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If ContinueOnError property is true, no error is caught when the project is executed even if Catch node is used.
Input
- Page Id - The ID of the web page to upload the file. This ID is generated by the Open Browser node.
- Selector Type - The type of selector to use, either XPath or CSS.
- Selector - The selector element of the
<input>element that is used to upload the file. - File Path - The path of the file to upload.
Options
- Wait Timeout (sec) - The time in seconds to wait until the file upload element appears. (Default: 5)
How It Works
- The node receives the Page ID, Selector Type, Selector, and File Path
- It validates that Page ID, Selector, and File Path are not empty
- It waits for any configured delay before execution
- It verifies that the specified file exists on the file system
- It retrieves the active page session using the provided Page ID
- The node waits for the file input element to appear on the page (up to Wait Timeout)
- Once the input element is located, it verifies the element is available
- The node uploads the file by setting the file path on the input element
- The browser handles the file upload process
- The node applies any configured delay after execution
Requirements
- An active browser session created by the Open Browser node
- A valid Page ID from the Open Browser node
- A valid CSS or XPath selector that identifies the file input element
- The selector must point to an
<input type="file">element - The file to upload must exist at the specified path
- Appropriate file permissions to read the file
- The web page must have a file upload input element
Error Handling
| Error Code | Description |
|---|---|
| Core.Browser.UploadFile.ErrOnCreate | Configuration parsing error during node creation |
| Core.Browser.UploadFile.ErrOnMessage | Error parsing incoming message data |
| Core.Browser.UploadFile.ErrPageId | Page ID is empty or not provided |
| Core.Browser.UploadFile.ErrSession | Invalid or expired Page ID, session not found |
| Core.Browser.UploadFile.ErrSelector | Selector is empty, or File Path is empty |
| Core.Browser.UploadFile.ErrFileNotFound | The specified file does not exist at the given path |
| Core.Browser.UploadFile.InvalidField | Invalid value for Wait Timeout field |
| Core.Browser.UploadFile.WaitElement | File input element not found within timeout period |
| Core.Browser.UploadFile.ErrElements | Failed to retrieve element from selection |
| Core.Browser.UploadFile.ErrUpload | Failed to upload the file to the element |
Usage Examples
Example 1: Uploading Profile Picture
When automating profile picture upload:
1. Use Open Browser and navigate to profile settings page
2. Use Upload File with:
- Selector Type: CSS
- Selector: input[type="file"][name="avatar"]
- File Path: C:/images/profile.jpg
- Wait Timeout: 10 seconds
3. The file is uploaded to the input element
4. Use Click Element to submit the upload form
5. Wait for upload confirmation
Example 2: Batch File Upload
When uploading multiple files in sequence:
1. Navigate to file upload page
2. For each file in your file list:
- Use Upload File with the current file path
- Wait for upload indicator (optional)
3. After all files are uploaded, submit the form
4. Continue with confirmation handling
Example 3: Document Submission
When automating document submission workflows:
1. Fill out form fields with document metadata
2. Use Upload File with:
- Selector Type: XPath
- Selector: //input[@id='document-upload']
- File Path: D:/documents/report.pdf
- Wait Timeout: 15 seconds
3. Add a delay to allow file validation
4. Use Click Element to submit the document
5. Wait for submission confirmation
Usage Notes
- Upload File only works with standard HTML
<input type="file">elements - The file path must be absolute, not relative
- The file must exist and be readable before upload
- Custom file upload widgets (drag-drop, JavaScript-based) may not work
- Multiple file uploads require multiple Upload File node calls
- Some sites validate file types/sizes - ensure files meet requirements
- Large files may take time to upload, add appropriate delays
- The node sets the file path but doesn't trigger the upload submission
- You typically need to click a submit button after using this node
Tips
- Always verify the file exists before running the automation
- Use absolute file paths to avoid path resolution issues
- Check file size limits on the website before uploading
- Add appropriate Wait Timeout for dynamically loaded file inputs
- Test file type restrictions (jpg, pdf, etc.) before automation
- For large files, add delays after upload before submitting
- Use browser developer tools to identify the correct file input selector
- Consider using Continue On Error for optional file uploads
- Store file paths in variables for dynamic file selection
- Verify upload success by checking for confirmation messages
Related Nodes
- Open Browser - Creates the browser session and Page ID
- Wait Element - Waits for file input before upload
- Click Element - Submits upload form after file selection
- Get Value - Verifies file input value after upload