Wait for Selector
Wait for specific elements to become available before proceeding with data extraction.Basic Wait for Selector
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Must be "wait_for_selector" |
selector | string | Yes | CSS selector for the element to wait for |
timeout | integer | No | Max wait time in milliseconds (default: 10000) |
visible | boolean | No | Wait for element to be visible (default: true) |
hidden | boolean | No | Wait for element to be hidden (default: false) |
Wait Conditions
Wait for Visibility
Wait for an element to become visible:Wait for Element to Hide
Wait for an element to disappear:Wait for DOM Presence
Wait for element to exist in DOM (regardless of visibility):Use Cases
Dynamic Content Loading
Wait for AJAX-loaded content:Form Validation
Wait for form validation messages:Modal Dialogs
Wait for popup modals to appear:Single Page Applications
Wait for SPA route changes:Advanced Selectors
Attribute Selectors
Complex Selectors
Multiple Class Selector
Error Handling
Element Not Found
Timeout Exceeded
Performance Optimization
Appropriate Timeouts
Specific Selectors
Chaining with Other Actions
Wait, Then Extract
Wait, Then Interact
Common Patterns
Loading States
Progressive Enhancement
Best Practices
Selector Specificity
- Use unique selectors when possible
- Prefer IDs and data attributes over generic classes
- Test selectors in browser dev tools first
- Consider element hierarchy for stability
Timeout Management
- Set realistic timeouts based on expected load times
- Use shorter timeouts for fast interactions
- Allow longer timeouts for heavy content
- Consider user experience - don’t wait too long
Error Recovery
SDK Examples
Node.js
Python
Related Actions
- Wait - Simple time-based delays
- Wait and Click - Wait for element then click
- Wait and Type - Wait for element then type text

