Element Detection and OCR Issues
Solutions for element selection, text recognition, and detection problems
This guide helps you resolve issues with element detection, OCR accuracy, and text recognition problems.
Element Not Found
When AskUI can’t find an element you’re trying to interact with:
Quick Diagnostics
- Capture what the agent sees:
- Check element visibility:
Solutions
Use More Specific Descriptions
Use Relative Positioning
Check Multi-Monitor Setup
Wrong Element Selected
When AskUI selects the wrong element from multiple similar ones:
Solutions
Add Context with Relative Locators
Use Index for Specific Instances
Combine Multiple Locators
OCR and Text Recognition Issues
Misspellings and Character Confusion
Problem: The OCR model sometimes misreads characters, especially in certain fonts or noisy images. This can result in words being misclassified or misspelled, which then causes the automation to fail when it searches for exact matches.
✅ Expected Behavior
ⵊ Text is correctly spelled:
✅ Hallo ✅
👍 Works with click().text("Hallo")
❌ Actual Issue
ⵊ Text is misspelled
❌ HaII0
❌
👎 Can’t find click().text("Hallo")
. Because of recognition issues. (l
→I
and o
→ 0
)
Solutions:
Re-Teach Sentence-Level OCR Model
Re-Teach Sentence-Level OCR Model
You can directly correct OCR predictions and improve OCR model accuracy by training your workspace-specific model:
Steps:
-
Start the AskUI shell:
-
Launch the OCR Teaching App:
-
Upload a screenshot containing the misclassified word (e.g., “Hallo”).
-
Switch to Trained Model for precise corrections.
-
Select the wrongly detected word (
HaII0
) and replace it with the correct label:Hallo
. -
Press the Train Correction
-
Click “Copy Model” to copy the newly trained model ID.
-
In your automation code, update on model config on global level or on step level to use the new model:
Global Level Model Composition
Step Level Model Composition
Use Fuzzy Matching
Use Fuzzy Matching
Create AI Elements
Create AI Elements
For consistently problematic elements:
Steps:
- Open AskUI Shell
- Create a new AI Element
- 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.
Text Merging Issues
Problem: Sometimes, Text Detector/annotation tool merges an icon and texts into one, even though they look separate on screen.
Example: Say you want to click just the name “Alice Johnson” field or just the position field in an interface - but OCR detects them as one long string:
✅ Expected Behavior
🖼️ Icon and Text are detected separately:
🧑 ✅ Name ✅ 🤖 ✅ Role ✅
👍 Works with click().text("Name")
or click().text("Role")
❌ Actual Issue
🖼️ Icon and text are detected together:
🧑 Name
❌ 🤖 Role
✅
👎 Can’t find click().text("Name")
.
Solutions:
Re-Teach Sentence-Level OCR Model
Re-Teach Sentence-Level OCR Model
You can train the OCR Recognition model to ignore the OCR detection error:
Steps:
-
Start the AskUI shell:
-
Launch the OCR Teaching App:
-
Upload a screenshot containing the misclassified word (e.g., “Hallo”).
-
Switch to Trained Model for precise corrections.
-
Select the wrongly detected word (
HaII0
) and replace it with the correct label:Hallo
. -
Press the Train Correction
-
Click “Copy Model” to copy the newly trained model ID.
-
In your automation code, update on model config on global level or on step level to use the new model:
Global Level Model Composition
Step Level Model Composition
Use Positional Selectors
Use Positional Selectors
Extract and Parse
Extract and Parse
Merged Texts
Problem: Sometimes, Text Detector/annotation tool merges two separate texts into one, even though they look clearly split on screen.
Example: Say you want to click just the name “Alice Johnson” field or just the position field in an interface - but OCR detects them as one long string:
✅ Expected Behavior
🖼️ Text fields detected separately:
Alice Johnson
✅ Software Engineer
✅
👍 Works with text("Alice Johnson")
or text("Software Engineer")
❌ Actual Issue
🖼️ Texts merged into one block:
Alice Johnson Software Engineer
❌
👎 Can’t find either one on its own.
Solutions:
Use Different Model Composition
Use Different Model Composition
Switch to word-level detection for better text separation
Use Relative Positioning
Use Relative Positioning
Text Separation
Problem: Sometimes, Text Detector/annotation tool separates a text into two texts, even though they look clearly merged on screen.
Example: Say you want to click “Alice Johnson” as one field - but OCR detects them as two separate words:
✅ Expected Behavior
🖼️ Words are detected as one sentence:
Alice Johnson
✅
👍 Works with text("Alice Johnson")
❌ Actual Issue
🖼️ Words are detected as separated texts:
Alice
❌ Johnson
❌
👎 Can’t find text("Alice Johnson")
as one.
Solutions:
Click Individual Words
Click Individual Words
Use Proximity Selection
Use Proximity Selection
Vertical Text Merging
Problem: Sometimes, Text Detector/annotation tool merges two lines to one text, even though they look clearly as two lines on screen.
✅ Expected Behavior
🖼️ Texts are detected as two lines:
Alice Johnson
✅
👍 Works with text("Alice Johnson")
❌ Actual Issue
🖼️ Texts are detected as one text:
<no words recognized>
❌
👎 Can’t find text("Alice Johnson")
on its own.
Solutions:
Use Different Model Composition
Use Different Model Composition
Switch to word-level detection for better line separation
Use AI Elements
Use AI Elements
Create custom AI elements for problematic multi-line text
Steps:
- Open AskUI Shell
- Create a new AI Element
- 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.
Single Character Not Detected
Problem: Sometimes, Text Detector/annotation tool does not detect single characters, even though they are clearly visible on screen.
Example: Say you want to click just the character “2” - but OCR does not detect it:
✅ Expected Behavior
🖼️ Single chars are detected:
1
✅ 2
✅ 3
✅
👍 Works with text("2")
❌ Actual Issue
🖼️ Char 2 is not detected:
1
✅ 2
❌ 3
✅
👎 Can’t find text("2")
.
Solution:
Use AI Element
Use AI Element
Single characters are sometimes flaky. It’s better to rely on AI elements:
Steps:
- Open AskUI Shell
- Create a new AI Element
- 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.
Text Not Detected
Problem: Sometimes, for no apparent reason, Text Detector/annotation tool does not detect a text, even though you can see it clearly on screen.
Example: Say you want to click just the name “Alice Johnson” field - but OCR does not detect the text at all:
✅ Expected Behavior
🖼️ Text was detected:
Alice Johnson
✅
👍 Works with text("Alice Johnson")
❌ Actual Issue
🖼️ Text wasn’t detected
Alice Johnson
❌
👎 Can’t find text("Alice Johnson")
.
Common Causes:
- Low contrast text
- Decorative fonts
- Text on complex backgrounds
- Very small or very large text
- Rendering issues or timing
Solutions:
Use AI Element
Use AI Element
When text is not detected, the most reliable solution is to use AI Elements:
Steps:
- Open AskUI Shell
- Create a new AI Element
- 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.
Wait for Full Render
Wait for Full Render
Try Different Selection Methods
Try Different Selection Methods
Windows-Specific Issues
ButtonEvent Access Denied
Error: ButtonEvent down failed: Access is denied
This occurs when:
- Windows Lock Screen is active
- RDP session is minimized
Solutions:
-
For Lock Screen: Ensure system is unlocked before running automation
-
For RDP: Keep session active by setting this registry key on the client machine:
Performance Optimization
Slow Element Detection
Solutions:
- Cache locators:
- Use specific locators:
- Reduce search scope:
Debugging Tips
Enable Verbose Logging
Visual Debugging
Interactive Debugging
Common Patterns
Retry Logic
Wait for Element
Next Steps
- Having data extraction issues? See Data Extraction Troubleshooting
- Network problems? Check Network and Connectivity
- Need to report an issue? Visit Reporting Bugs