Overview
When automating Twitch with browser automation, chat messages are stored in a specific structure within the accessibility tree. This guide explains how to extract chat message content.
Chat Message Location
Chat messages are stored in the log container within:
complementary "Right Column"complementary "Stream Chat"region "Stream Chat"generic "Chat messages"log(actual chat log list)
Message Structure
Each message is a generic node with the full message in its accessible name:
generic "username: message content..."
Regular User Message
generic "username: Hello everyone!"
└─ generic
├─ button "username"
├─ text: ":"
└─ generic: Hello everyone! ← message body
Broadcaster Message
generic "broadcaster_name: Welcome to the stream!"
└─ generic
└─ generic
├─ button "Broadcaster badge"
├─ button "broadcaster_name"
├─ text: ":"
└─ generic: Welcome to the stream! ← message body
Extraction Methods
Method 1: Search by Username Pattern
Search for the parent generic node's accessible name:
Search pattern: "username:
This returns the full message including content.
Method 2: Navigate Tree Structure
For detailed message structure, navigate the accessibility tree from the chat log container to find individual message nodes.
Key Points
- The parent
genericnode's accessible name contains the full message:"username: message" - Older messages may have timestamp prefix:
"Sent at 1:40, username: message" - The actual message text is in a child
genericnode aftertext: ":" - Broadcaster messages have deeper nesting due to badge elements
Common Issues
- Summary view limitations: Default output may only show buttons/links, not message text
- Solution: Navigate the full tree structure, or search for
"username:pattern to get full message content