Interact action types
| Type | Required fields | Purpose |
|---|---|---|
navigate | url | Move to a new URL inside the same session. |
click | selector | Click a DOM element. |
fill | selector, value | Fill an input or textarea. |
wait | ms | Sleep for a fixed duration. |
wait_for_selector | selector | Wait until the selector appears. |
press | key | Send a keyboard key. |
scroll | amount or selector | Scroll the page or a target element. |
screenshot | none | Capture the rendered state. |
extract | format | Return markdown, html, or text. |
Action planning tips
- prefer
wait_for_selectorover blind sleeps whenever possible - use
extractas the final action so the payload reflects the completed state - keep actions small and deterministic; split very long flows into multiple calls with
profile_id
Action type baseline
```bash
curl https://api.faircompany.ai/v1/crawl/interact \
-X POST \
-H "Authorization: Bearer fc_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/login",
"actions": [
{ "type": "fill", "selector": "#email", "value": "user@example.com" },
{ "type": "fill", "selector": "#password", "value": "super-secret" },
{ "type": "click", "selector": "button[type=\"submit\"]" },
{ "type": "wait_for_selector", "selector": ".dashboard", "timeout_ms": 10000 },
{ "type": "extract", "format": "markdown" }
]
}'
```
```ts
const session = await fc.interact({
url: "https://example.com/login",
actions: [
{ type: "fill", selector: "#email", value: "user@example.com" },
{ type: "fill", selector: "#password", value: "super-secret" },
{ type: "click", selector: 'button[type="submit"]' },
{ type: "wait_for_selector", selector: ".dashboard", timeout_ms: 10000 },
{ type: "extract", format: "markdown" },
],
});
console.log(session.profile_id);
console.log(session.markdown);
```
```python
session = fc.interact(
"https://example.com/login",
[
{"type": "fill", "selector": "#email", "value": "user@example.com"},
{"type": "fill", "selector": "#password", "value": "super-secret"},
{"type": "click", "selector": "button[type=\"submit\"]"},
{"type": "wait_for_selector", "selector": ".dashboard", "timeout_ms": 10000},
{"type": "extract", "format": "markdown"},
],
)
print(session.profile_id)
print(session.markdown)
```
```json
{
"tool": "faircrawl_interact",
"arguments": {
"url": "https://example.com/login",
"actions": [
{ "type": "fill", "selector": "#email", "value": "user@example.com" },
{ "type": "fill", "selector": "#password", "value": "super-secret" },
{ "type": "click", "selector": "button[type=\"submit\"]" },
{ "type": "wait_for_selector", "selector": ".dashboard", "timeout_ms": 10000 },
{ "type": "extract", "format": "markdown" }
]
}
}
```