An element is any individual component on a webpage or software interface—such as text, images, buttons, or input boxes. In Octoparse AI, elements are the targets of your automation. We primarily use built-in selector to pinpoint the exact location of these elements among the hundreds of components on a page.
The Capture Process: Methods and Tools
You can initiate element capture directly from within a command (e.g., Get details of element on web page) or via the Element Library in the flow editor.
When you enter capture mode, a floating "Capturing" window appears.
Capture one element:
Ctrl + Left Clickto pick a specific item, such as a search bar.Capture similar elements:
Shift + Clickthe first and second items in a list. This allows the robot to recognize patterns, which is essential for the "Loop through similar web elements" command.
Choosing Your Strategy: Smart vs. Structure-based
How the robot identifies an element depends on the locator strategy you choose.
Smart Locator: (Recommended for dynamic sites) Uses an optimized algorithm that prioritizes fixed attributes like ID and Class. It is highly adaptable to layout updates.
Structure-based locator: Uses standard XPath expressions. While it provides total manual control for custom editing, auto-generated paths can be fragile if the website hierarchy changes.
Advanced Operations: Validate and Edit
Capturing is only the first step. To ensure long-term stability, use the following functions:
Validate Element: Use this to check which position on the current page matches your saved element. It helps confirm if your XPath is still effective.
Edit Element: Open the element editor to refine your XPath or switch between Smart and Structure-based modes for more precise adjustments.
Common Failures
Issue | Potential Cause | Recommended Solution |
Cannot be captured | Page scripts haven't finished loading. | Add a Wait for web page to load command before the capture step. |
Element does not exist | The element uses dynamic attributes (e.g., random IDs). | Open the Edit element window and manually replace the dynamic path with a stable attribute. |
Wrong element identified | Multiple elements share the same attributes. | Use the Structure-based locator to add filters, such as text content (e.g., //button[text()="Confirm"]). |
