Debugging Tools
PhoneClaw provides several tools and techniques to help you debug your automation scripts and understand what’s happening during execution.Using speakText for Debugging
ThespeakText() function is your primary debugging tool. It provides audio feedback about script execution and can help you understand where your automation is succeeding or failing.
Basic Debug Output
Variable Inspection
Checkpoint Debugging
Error Handling
Try-Catch Blocks
Wrap potentially failing operations in try-catch blocks to gracefully handle errors:Comprehensive Error Handling
Debugging magicClicker
Test Element Visibility
Before using magicClicker, verify the element is visible:Progressive Description Refinement
Add Delays for UI Loading
Debugging magicScraper
Verify Scraped Content
Validate Scraped Data
Question Refinement
Debugging Scheduled Tasks
Verify Schedule Creation
Test Schedule Timing
Start with a short interval for testing:Debugging Scheduled Script
Add timestamp logging:Common Debugging Patterns
State Machine Debugging
Conditional Debugging
Performance Timing
Testing Strategies
Incremental Testing
Isolation Testing
Test problematic sections in isolation:Android Debug Bridge (ADB)
For advanced debugging, use ADB to view system logs:View Logcat Output
Clear Logs and Reproduce
Best Practices
Start Simple
Begin with simple automations and add complexity gradually.
Add Logging
Use speakText liberally to track execution flow and variable values.
Handle Errors
Wrap risky operations in try-catch blocks with fallback logic.
Test Incrementally
Test each new addition before moving to the next step.
Use Delays
Add sufficient delays for UI loading and transitions.
Be Specific
Use detailed descriptions for magicClicker and magicScraper.
Getting Help
If you’re still stuck after debugging:Common Issues
Check if your issue is already documented
FAQ
Review frequently asked questions
Discord Community
Ask for help from experienced users
GitHub Issues
Report bugs with your debug logs