Browser Run:/accessibilityTree エンドポイント(アクセシビリティツリー取得)
Key Points
- アクセシビリティツリー取得
- AI/自動化向け構造化データ
- interestingOnly・root パラメータ
Summary
Browser Run に /accessibilityTree エンドポイントが追加され、レンダリング済みページのアクセシビリティツリー(role、name、state、value、階層)を直接取得できるようになりました。AI エージェントや自動化ワークフローはピクセル推論や生の HTML 解析を減らし、意味的なページ構造を直接利用できます。
Key Points
- エンドポイント:
POST /accounts/<accountId>/browser-run/accessibilityTree - リクエスト: JSON ボディに
urlを指定(例:{"url":"https://example.com/"}) - 出力:
accessibilityTreeオブジェクト(role、name、children、level、state などを含む) - オプション:
interestingOnly(意味的に重要なノードのみ)、root(特定サブツリーの取得) - 利用シーン: AI エージェントの要素特定・操作判定、自動テスト、アクセシビリティ解析
- 複数フォーマットが必要な場合は
/snapshotを利用(Markdown、HTML、スクリーンショットを同時取得) - 簡易例(curl):
curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-run/accessibilityTree' -H 'Authorization: Bearer <apiToken>' -H 'Content-Type: application/json' -d '{"url":"https://example.com/"}'