The Element Miner is a Functionize feature that allows you to drill down and locate elements using a specialized, proprietary syntax. Unlike traditional selector-based approaches (XPath, CSS), which rely on one or a handful of attributes, Element Miner works with millions of data points captured from your application. This provides far greater accuracy and resilience in test execution.
With Element Miner, you can:
- Select elements using granular, rule-based constraints.
- Handle complex or dynamic UI structures, such as:
- Identifying an element based on its relative position among similar elements.
- Finding elements based on page structure (siblings, parents, descendants).
You can access Element Miner on the Advanced tab of Action details in the Test Detail page or Slider View.
How Element Miner Works
Element Miner constrains the ML element selection model by applying definitions and rules. Each command narrows the search space, boosting accuracy.
- Each line of Element Miner code is treated as a single condition.
- Multiple lines are combined using an implicit AND operator.
- Operators like
|(OR),?(CONTAINS), and!=(NOT EQUALS) are also supported.- Note that operators like
|and&apply across values, while operators like?and!=apply at the attribute level.
- Note that operators like
- Attribute and text values are case-sensitive.
Commands
1. attribute
Matches elements using HTML attributes.
attribute(CL=main-menu, TV="User name", role=menu)
attribute(TV?"User") // CONTAINS operator
attribute(TN!="DIV") // NOT EQUALS
,= AND operator|= OR operator?= CONTAINS operator
Example:
attribute(CL=main-menu, TV="User name"| TV="email", TN=DIV)
Finds an element with class main-menu, text "User name" OR "email", and tag name DIV.
2. context
Correlates an element based on nearby or surrounding elements (visually or within the DOM).
context("password" | "login" | "username")
This locates, for example, an input field associated with a specific label.
Shortcut: if no attribute is specified, TV="value" is assumed.
3. content
Correlates an element based on its own content or child/descendant content.
content("Accept" | PH="Street address")
content("username")
This searches deeper into the DOM than attribute(TV="..."), making it better for text/content-based matches though slightly slower during execution. Use content() over attribute() when text or child content is the key factor.
Attribute Abbreviations
Here is the complete list of abbreviations used by the Element Miner model. If an attribute has an abbreviation, you should use the abbreviation instead of the full name.
| Attribute | Abbreviation |
| alt | AT |
| aria-hidden | AH |
| background-color | BC |
| class | CL |
| color | CR |
| display | DY |
| element (tag name) | TN |
| fill | FL |
| height | HT |
| hidden | HD |
| href | HF |
| left (x-position) | LT |
| onclick | OC |
| placeholder | PH |
| src | SC |
| style | ST |
| text | TV |
| title | TT |
| top (y-position) | TP |
| type | TY |
| viewbox | VB |
| width | WH |
Example
attribute(CL="btn btn-lg primary")
context("date")
content("Submit")
This finds a button with class btn btn-lg primary, located near the label date, and containing the text Submit.
Use Cases for Element Miner
- Constraining Element Search Space
- Element Miner reduces the search space of the element selection model by applying rules and definitions. This is especially useful for large web pages (30k+ nodes), ensuring faster and more accurate element identification.
- Attribute-Based Filtering
- Element Miner allows selecting elements using attribute-value correlations (e.g.,
class,id,role,textvalues). By applying strict or loose matching (e.g.,=,?,!=), Element Miner ensures precise element targeting. - Example:
attribute(CL=main-menu, TV="User name", role=menu)
- Element Miner allows selecting elements using attribute-value correlations (e.g.,
- Contextual Element Selection
- Element Miner uses context commands to filter elements by their relationship to nearby labels or structures. This is critical when elements lack unique identifiers.
- Example: Selecting the correct input field by matching the nearby label
usernamewithcontext("username")
- Content-Based Filtering
- It enables selecting elements by their text content or child attributes. This includes exact matches, partial matches (e.g.
contains()), regex filters, and even applying previously selected content for optimization in big pages. - Example:
content("Accept" | PH="Street address")
- It enables selecting elements by their text content or child attributes. This includes exact matches, partial matches (e.g.
- Structural and Positional Selection
- Element Miner supports filters based on structural properties (neighbors, viewport visibility, relative paths, spatial context). This ensures stable element selection even in dynamic DOMs or tabular data.
- Examples:
neighbor(10)retrieves 10 closest neighborsclear_hidden()filters only visible elements
- Specialized Use Cases (Drag & Drop, Tabular Data)
- Element Miner provides specialized commands for drag-and-drop operations (
_dropprefix) and row/column contexts to select elements aligned in tables or grids. - Examples:
row_context("user@example.com")_drop_attribute(ID="droparea")
- Element Miner provides specialized commands for drag-and-drop operations (
Benefits of Element Miner
- More resilient than brittle XPath/CSS selectors.
- Contextual intelligence: matches elements the way humans would.
- Higher stability in dynamic apps with changing DOMs.
By combining syntax constraints with ML, Element Miner enables precise, adaptive, and human-like element recognition, ensuring your Functionize tests run with maximum accuracy.