Element Selection
Learn how to find and select UI elements with AskUI’s powerful selection capabilities
Finding and Selecting UI Elements
AskUI provides multiple ways to find and select UI elements on your screen. This guide covers the different approaches, from simple text-based selection to advanced locator strategies.
Natural Language Selection
The simplest way to interact with UI elements is using natural language descriptions. AskUI’s Vision Agent understands everyday language to find elements on your screen.
Benefits of Natural Language Selection
- Intuitive: Use everyday language to describe elements
- Context-Aware: Understands elements based on their visual appearance and surroundings
- Flexible: Works across different applications and interfaces
- Maintainable: No need to update selectors when UI changes slightly
Advanced Selection with Locators
For more precise element selection, use AskUI’s locator system to build sophisticated element selectors.
Basic Locators
Relative Locators
Build complex selectors by describing element relationships:
Available Locator Methods
Text()
: Find elements by their text contentElement()
: Find elements by their type:"text"
: Text elements"textfield"
: Input fields
Image()
: Find elements by their visual appearanceAiElement()
: Use AI-captured elements for reliable selection
Locator Relationships
right_of()
: Element is to the right of another elementleft_of()
: Element is to the left of another elementabove()
: Element is above another elementbelow()
: Element is below another elementnear()
: Element is near another element
Multi-Monitor Support
When working with multiple monitors, specify which display to automate:
AI Elements
For complex or dynamic elements, use AI Elements to capture and reuse specific visual elements:
Use captured AI Elements in your code:
If you cannot use the AskUI-NewAIElement command, activate experimental commands by running AskUI-ImportExperimentalCommands
in your terminal.
Best Practices
- Start Simple
- Use natural language selection for basic cases
- Only use locators when needed for precision
- Be Specific
- Use clear, descriptive text for natural language selection
- Combine multiple locators for unique identification
- Use the correct element types with
Element()
locator
- Handle Dynamic Content
- Use relative locators for elements that move
- Consider AI Elements for complex visual patterns
- Multi-Monitor Setup
- Test on each monitor to find the correct display number
- Use consistent display settings across your team
By following these guidelines, you’ll create robust and maintainable element selection strategies for your automation workflows.