DOM-Only Rule
Purpose
WhatsApp detects patterns of Store API calls and can ban accounts. All data extraction must read from rendered HTML using standard DOM queries. This rule is non-negotiable.
What Is Forbidden
NEVER call window.Store.* methods:
Store.Contact.get()Store.Chat.getModelsArray()getProfilePicThumb()- Any other Store API
NEVER use whatsapp-web.js client API for data visible on screen:
client.getContactById()client.getChatById()(for reading data)chat.fetchMessages()(for reading visible messages)
What Is Allowed
ALWAYS read from rendered HTML:
document.querySelectorAll()<img>src attributes for avatars- Element text content for names, messages, timestamps
- React fiber props for chat IDs (
memoizedProps.chat.id._serialized)
Navigate naturally:
- Click elements using
page.mouse.click(x, y)(NOTelement.click()) - Scroll to trigger WhatsApp’s own rendering
- Type in search boxes using
page.keyboard.type()
Exceptions
Binary media downloads are allowed because no rendered equivalent exists:
msg.downloadMedia()— for downloading photos, videos, documents- This is the only acceptable use of the whatsapp-web.js client API for data retrieval
Sending messages/reactions — writing operations are fine:
msg.react(emoji)chat.sendMessage()- These don’t read data from Store
Key DOM Selectors
| Data | Selector | Notes |
|---|---|---|
| Chat list | #pane-side [role="grid"] [role="row"] |
Virtualized, ~60-70 rows |
| Chat IDs | React fiber memoizedProps.chat.id._serialized |
NOT in data attributes |
| Avatars | img[src*="pps.whatsapp.net"] |
CDN URLs |
| Contact names | span[title] inside chat rows |
First span with title attribute |
| Conversation | #main |
Appears after clicking a chat |
| Messages | div[data-id="true_..."] / div[data-id="false_..."] |
true=sent, false=received |
| Unread count | [aria-label*="unread"] |
Badge element |
| Archive button | [data-icon="archive-refreshed"] |
SVG icon, parent is BUTTON |
| Archived items | [role="listitem"] |
Different from normal [role="row"] |
Critical Navigation Rule
All clicks MUST use page.mouse.click(x, y) — JavaScript element.click() does NOT trigger WhatsApp Web’s React event handlers.
Viewport Requirement
Viewport must be at least 1000px wide (recommended: 1366x768) or WhatsApp goes single-column and the chat list disappears.
Status
Active and enforced. All DOM reads use querySelectorAll and natural navigation.