Repair Broken Selectors
ScraperQ's Selector Repair Engine (CSRE) automatically fixes broken templates when websites update their layout.
How CSRE Works
The Selector Repair Engine uses a multi-stage approach to fix broken selectors.
When a website changes its HTML structure, the CSS selectors in your template may break. CSRE handles this automatically:
Detection
CSRE monitors health signals for every selector during scraping. When a selector fails to match elements, it's flagged as broken.
Hierarchical Repair
CSRE tries multiple repair strategies in order: stable attributes → semantic matching → AI-powered fix.
Approval & Auto-Fix
When a repair is found, ScraperQ shows you the proposed fix. After approval, the template is updated and your next run works.
Repair Strategies
CSRE uses multiple strategies to find the best replacement selector.
1. Stable Attributes
First, CSRE looks for stable HTML attributes that are unlikely to change:
data-testid— test identifiersaria-label— accessibility labelsid— unique IDs (if stable)name— form element names
2. Semantic Matching
If stable attributes aren't available, CSRE analyzes the semantic structure:
- Element hierarchy and nesting patterns
- Text content similarity
- Position within parent containers
- Adjacent element relationships
3. AI-Powered Fix
As a last resort, CSRE uses AI to analyze the page and suggest a new selector:
- Analyzes the original field description
- Searches for similar content on the updated page
- Generates a new CSS selector that targets the same data
Credit Cost
Repair Workflow
Step-by-step guide to repairing broken selectors.
Broken Selector Detected
When you run a template and a selector fails, ScraperQ displays a notification with the broken field(s).
Broken selector alert
Replace with actual extension screenshot
Review Repair Suggestions
CSRE analyzes the page and presents repair options. For each broken selector, you'll see:
- The original selector
- The proposed replacement selector
- Preview of what the new selector matches
- Confidence score for the repair
Repair suggestions panel
Replace with actual extension screenshot
Approve or Reject
For each suggested repair:
- Approve — accept the new selector and update the template
- Reject — skip this repair and manually edit if needed
- Edit — modify the selector yourself before approving
Template Updated
After approval, your template is updated. The next time you run it, the new selectors will work correctly.
Automatic Future Repairs
Manual Selector Editing
For advanced users who want full control over selectors.
You can always manually edit selectors if the AI suggestion doesn't work:
Enter Edit Mode
In the template editor, click on any field to open the selector editor.
Use Selector Picker
Click on any element on the page to auto-generate a CSS selector. Or type your own selector in the input field.
Selector Tips
- Use
.class-namefor class selectors - Use
#element-idfor ID selectors - Use
div > pfor child selectors - Use
[data-testid="value"]for attribute selectors
Test Selector
Click "Test" to verify the selector matches the correct elements on the page.
Test Case: Repairing a Product Template
A practical example of the repair workflow.
Scenario: E-commerce Site Updates Product Cards
- Run your "Product Listing" template
- ScraperQ detects: "product-title" selector returns 0 results
- CSRE analyzes the updated page structure
- CSRE finds: new class name is "product-card__title"
- ScraperQ shows repair suggestion with confidence: 95%
- You approve the repair
- Template is updated, next run works correctly
Expected Result: Template successfully repaired, data extraction resumes with correct product titles.