Page Monitoring
Fresh Source: docs.airtop.aiThe monitor method watches a page for a specific condition at configurable intervals. When the condition is met (or the timeout expires), it returns the result.
Basic Usage
typescript
const result = await client.windows.monitor(sessionId, windowId, {
condition: 'The product price drops below $100',
configuration: {
intervalMs: 5000, // Check every 5 seconds
timeoutMs: 300000, // Give up after 5 minutes
},
});
if (result.data.conditionMet) {
console.log('Condition met:', result.data.modelResponse);
} else {
console.log('Timed out');
}python
result = client.windows.monitor(session_id, window_id,
condition="The product price drops below $100",
configuration={
"intervalMs": 5000,
"timeoutMs": 300000,
}
)
if result.data.condition_met:
print(f"Condition met: {result.data.model_response}")
else:
print("Timed out")Configuration
| Parameter | Type | Description |
|---|---|---|
condition | string | Natural language condition to watch for |
intervalMs | number | Time between checks in milliseconds |
timeoutMs | number | Maximum wait time before giving up |
Response Fields
| Field | Type | Description |
|---|---|---|
conditionMet | boolean | Whether the condition was satisfied |
modelResponse | string | AI description of what was observed |
Visual Analysis
The monitor doesn't just check text — it can analyze visual changes on the page:
typescript
// Watch for visual indicator changes
await client.windows.monitor(sessionId, windowId, {
condition: 'The status badge changes from "Pending" (yellow) to "Complete" (green)',
configuration: { intervalMs: 3000, timeoutMs: 120000 },
});Use Case Examples
Price Monitoring
typescript
const result = await client.windows.monitor(sessionId, windowId, {
condition: 'The price displayed on the page is less than $50',
configuration: { intervalMs: 10000, timeoutMs: 600000 },
});python
result = client.windows.monitor(session_id, window_id,
condition="The price displayed on the page is less than $50",
configuration={"intervalMs": 10000, "timeoutMs": 600000}
)Stock Availability
typescript
const result = await client.windows.monitor(sessionId, windowId, {
condition: 'The product shows as "In Stock" or an "Add to Cart" button is visible',
configuration: { intervalMs: 15000, timeoutMs: 900000 },
});Content Updates
typescript
const result = await client.windows.monitor(sessionId, windowId, {
condition: 'A new article or post appears that was not visible when monitoring started',
configuration: { intervalMs: 30000, timeoutMs: 3600000 },
});Build/Deploy Status
typescript
const result = await client.windows.monitor(sessionId, windowId, {
condition: 'The deployment status changes to "Success" or "Failed"',
configuration: { intervalMs: 5000, timeoutMs: 300000 },
});Best Practices
- Match session timeout to monitor timeout — ensure
timeoutMinutes>timeoutMs / 60000 - Use reasonable intervals — 5-30 seconds for most cases; faster intervals use more credits
- Be specific in conditions — "price drops below $50" is better than "price changes"
- Handle both outcomes — always check
conditionMetand handle the timeout case - Combine with actions — after condition is met, use
click/typeto act - Set cost thresholds — long-running monitors can accumulate costs