Skip to main content

Alert

Used to close an Alert popup dialog, confirm and cancel an Alert dialog or just get the text from alert.

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 the ContinueOnError property is true, no error is caught when the project is executed even if the Catch node is used.

Input

  • Page Id - Id of the browser page where the alert is displayed. This ID is generated by the Open Browser node.

Output

  • Text - The text received from the alert popup.

Options

  • Action - The action to be performed on the alert popup. Available options are:
    • Confirm - Clicks the 'Ok' button on the alert popup.
    • Cancel - Clicks the 'Cancel' or 'X' button on the alert popup.
    • Get Text - Gets the text from the alert popup.

Note that if you choose the 'Get Text' option, the text received from the alert popup will be provided as the output of the node.

How It Works

  1. The node receives the Page ID of the browser window containing the alert
  2. It retrieves the active page session using the provided Page ID
  3. Based on the selected action, it performs one of the following:
    • Confirm: Accepts the alert by clicking the 'OK' button
    • Cancel: Dismisses the alert by clicking 'Cancel' or 'X'
    • Get Text: Retrieves the text message from the alert without closing it
  4. If Get Text action is selected, the alert text is stored in the output variable
  5. 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
  • An alert, confirm, or prompt dialog must be present on the page
  • The alert must be actively displayed when the node executes

Error Handling

Error CodeDescription
Core.Browser.Alert.ErrOnCreateConfiguration parsing error during node creation
Core.Browser.Alert.ErrOnMessageError parsing incoming message data
Core.Browser.Alert.ErrSessionInvalid or expired Page ID, session not found
Core.Browser.Alert.ErrConfirmFailed to confirm the alert popup
Core.Browser.Alert.ErrCancelFailed to cancel the alert popup
Core.Browser.Alert.GetTextFailed to retrieve text from the alert popup
Core.Browser.Alert.ErrTypeUnknown action type selected

Usage Examples

Example 1: Confirming a Delete Confirmation

When automating a web application that shows a "Are you sure you want to delete?" confirmation:

1. Use Click Element to click the delete button
2. Use Alert node with Action = "Confirm" to accept the deletion
3. Continue with your automation flow

Example 2: Reading Alert Message Before Accepting

When you need to verify the alert message before proceeding:

1. Use Alert node with Action = "Get Text" to read the message
2. Store the output in a variable (e.g., alertMessage)
3. Use If condition to check if the message contains expected text
4. Use another Alert node with Action = "Confirm" or "Cancel" based on the condition

Example 3: Handling Login Error Messages

When automating login and checking for error alerts:

1. Enter credentials and click login
2. Use Alert node with Action = "Get Text" to capture any error message
3. Use If condition to check if alertMessage is empty (no error) or contains text (error occurred)
4. Use Alert node with Action = "Confirm" to close the error alert
5. Branch your logic based on login success or failure

Usage Notes

  • The alert must be present and visible when the node executes, otherwise it will fail
  • For "Get Text" action, the alert remains open after reading the text
  • You need a separate Alert node with "Confirm" or "Cancel" to close it after reading
  • If Continue On Error is enabled, errors are suppressed but the alert may remain open
  • The node works with JavaScript alerts, confirms, and prompts
  • Delay Before and Delay After can help with timing issues if alerts appear slowly

Tips

  • Always use "Get Text" first if you need to verify alert content before accepting/canceling
  • Use appropriate delays if alerts take time to appear after triggering actions
  • Consider using Try-Catch blocks to handle cases where alerts may or may not appear
  • Test your automation with different browser speeds to ensure alerts are handled correctly
  • For debugging, use Get Text to log alert messages to understand application behavior
  • Open Browser - Creates the browser session and Page ID
  • Click Element - Often used to trigger actions that show alerts
  • Wait Element - Can be used to wait for conditions before alert appears
  • Run Script - Can trigger JavaScript alerts for testing