Click Element
Clicks on an element in a 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 webpage to click element on. This ID is generated by the Open Browser node.
- Selector Type - The type of selector to use. The options are "XPath" and "CSS".
- Selector - The selector of the element to click on.
Options
- Wait Timeout (sec) - The time in seconds that Click Element will wait for the element to be visible before throwing an error.
- Click Type - The type of click that will be performed on the element. The options are "Single Click", "Double Click", "Right Click", "Middle Click", "Hold Click", and "Release Click".
How It Works
- The node receives the Page ID and waits for any configured delay before execution
- It validates that the Page ID and Selector are not empty
- It retrieves the active browser page session using the Page ID
- The node waits for the element to appear on the page (up to the Wait Timeout duration)
- For Safari browsers, it uses JavaScript execution to perform the click
- For other browsers (Chrome, Firefox, Edge), it locates the element using the provided selector
- Based on the Click Type option, it performs the appropriate click action on the element
- 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 uniquely identifies the target element
- The target element must be clickable and visible on the page
- The element must appear within the specified Wait Timeout period
Error Handling
| Error Code | Description |
|---|---|
| Core.Browser.ClickElement.ErrOnCreate | Configuration parsing error during node creation |
| Core.Browser.ClickElement.OnMessage | Error parsing incoming message data |
| Core.Browser.ClickElement.ErrPageId | Page ID is empty or not provided |
| Core.Browser.ClickElement.ErrSession | Invalid or expired Page ID, session not found |
| Core.Browser.ClickElement.ErrSelector | Selector is empty or not provided |
| Core.Browser.ClickElement.InvalidField | Invalid value for Wait Timeout field |
| Core.Browser.ClickElement.WaitElement | Element not found within the specified timeout period |
| Core.Browser.ClickElement.ErrElements | Failed to retrieve element from selection |
| Core.Browser.ClickElement.ErrClick | Failed to perform single click |
| Core.Browser.ClickElement.ErrDoubleClick | Failed to perform double click |
| Core.Browser.ClickElement.ErrRightClick | Failed to perform right click |
| Core.Browser.ClickElement.ErrMiddleClick | Failed to perform middle click |
| Core.Browser.ClickElement.ErrHoldClick | Failed to hold click |
| Core.Browser.ClickElement.ErrReleaseClick | Failed to release click |
| Core.Browser.ClickElement.ErrMoveMouse | Failed to move mouse to element |
| Core.Browser.ClickElement.ClickType | Unknown click type selected |
| Core.Browser.ClickElement.ErrForward | Failed to execute click script (Safari) |
Usage Examples
Example 1: Clicking a Submit Button
When automating form submission:
1. Use Type Text or Set Value nodes to fill form fields
2. Use Click Element with:
- Selector Type: CSS
- Selector: button[type="submit"]
- Click Type: Single Click
- Wait Timeout: 10 seconds
3. Continue with form submission handling
Example 2: Opening Context Menu
When you need to access a right-click context menu:
1. Use Click Element with:
- Selector Type: XPath
- Selector: //div[@class='file-item']
- Click Type: Right Click
- Wait Timeout: 5 seconds
2. Use another Click Element to select an option from the context menu
3. Continue with your automation flow
Example 3: Drag and Drop Operation
When implementing drag and drop functionality:
1. Use Click Element on the source element with:
- Click Type: Hold Click
- Wait Timeout: 5 seconds
2. Use Move to Element to move to the target location
3. Use Click Element with:
- Click Type: Release Click
- Selector: (target element selector)
4. Complete the drag and drop operation
Usage Notes
- The node automatically waits for the element to appear before attempting to click
- For Safari browsers, clicks are performed using JavaScript, which may behave differently than native clicks
- Hold Click and Release Click must be used in pairs for drag and drop operations
- Right Click and Middle Click first move the mouse to the element, then perform the click
- If the element is not visible or is covered by another element, the click may fail
- The Wait Timeout should be long enough for dynamic content to load
- Single Click is the most commonly used click type for standard interactions
Tips
- Use CSS selectors when possible as they are generally faster than XPath
- Increase Wait Timeout for elements that load slowly or require API calls
- Use the browser's developer tools to test and verify your selectors
- For elements that appear after page interactions, add appropriate Wait Timeout values
- If clicks are not registering, try adding a small Delay Before to allow page stabilization
- Consider using Wait Element node before Click Element for better control over element readiness
- For debugging, enable Continue On Error temporarily and check element visibility manually
Related Nodes
- Open Browser - Creates the browser session and Page ID
- Wait Element - Waits for elements to be ready before clicking
- Move to Element - Moves mouse to an element without clicking
- Type Text - Types text into input fields
- Get Value - Retrieves values from elements after clicking