alibaba/page-agent · warning
Error checking text node visibility:
Error message
Error checking text node visibility:
What it means
During DOM tree construction, isTextNodeVisible wraps visibility checks (checkVisibility plus a getComputedStyle fallback) in try/catch; any unexpected exception while inspecting a text node's parent logs this warning and the node is treated as invisible. It is a non-fatal warning so one bad node never breaks the whole page extraction.
Source
Thrown at packages/page-controller/src/dom/dom_tree/index.js:632
return false
}
// Check parent visibility
const parentElement = textNode.parentElement
if (!parentElement) return false
try {
return parentElement.checkVisibility({
checkOpacity: true,
checkVisibilityCSS: true,
})
} catch (e) {
// Fallback if checkVisibility is not supported
const style = window.getComputedStyle(parentElement)
return style.display !== 'none' && style.visibility !== 'hidden' && style.opacity !== '0'
}
} catch (e) {
console.warn('Error checking text node visibility:', e)
return false
}
}
/**
* Checks if an element is accepted.
*
* @param {HTMLElement} element - The element to check.
* @returns {boolean} Whether the element is accepted.
*/
function isElementAccepted(element) {
if (!element || !element.tagName) return false
// Always accept body and common container elements
const alwaysAccept = new Set([
'body',
'div',
'main',View on GitHub (pinned to d02db1ee7c)
Solutions
- Treat as benign: the node is skipped, extraction continues; verify your extraction still contains the content you need
- If content is missing, re-run updateTree() when the page is more settled (after load/spinner completes)
- Upgrade to a modern browser so checkVisibility is used instead of the throwing fallback
- If it floods logs, debounce updateTree calls and avoid indexing during heavy DOM mutation
Defensive patterns
Strategy: fallback
Prevention
- Treat the warning as non-fatal; verify extraction completeness separately
- Index after page load settles (spinners done) to reduce races
- Run in a modern browser so checkVisibility is available
- Avoid interleaving updateTree() with heavy DOM mutations
When it happens
Trigger: The parent element is in a detached document or a cross-origin iframe where getComputedStyle/checkVisibility throws; exotic or polyfilled DOM environments; nodes removed mid-traversal so their parent becomes null; jsdom or other non-browser DOM lacking full APIs.
Common situations: Pages with cross-origin iframes; heavy mutation during scraping causing races; test environments (jsdom) with partial CSSOM support; older browsers without checkVisibility where the fallback itself throws.
Related errors
- DOM tree not indexed yet. Can not perform actions on element
- No interactive element found at index ${index}
- Element at index ${index} does not have a reference
- Element at index ${index} is not an HTMLElement
- Element is not an input, textarea, or contenteditable
AI-assisted analysis of alibaba/page-agent@d02db1ee7c (2026-08-28).
Data as JSON: /api/errors/c16cc5110109f1ed.
Report an issue: GitHub.