I need to find the correspondence between a node in the DOM tree where a click occurred and the same node in the a11yTree. I get the DOM tree node by adding listeners to the page.
document.addEventListener('click', window.handleClick)
I use:
const { nodeId: nodeIdBySelector } = await CDPClient.send('DOM.querySelector', {
nodeId: root.nodeId,
selector: '.' + selector
})
to get the nodeId of an element. If I get the a11y tree:
const { nodes: axTree } = await CDPClient.send('Accessibility.getFullAXTree')
and try to find the node with the id obtained above, it won't be there (the id will be different).
Is there a way to find a node in the a11yTree using a node from the DOM tree?