I’m working with Puppeteer to automate interactions on a webpage. I have retrieved information from the accessibility tree using Puppeteer’s page.accessibility.snapshot()
method. The snapshot provides elements with unique id
values, but these IDs do not correspond to regular HTML attributes. I want to programmatically click on an element using its node ID from this snapshot.
Here’s what I’ve tried so far:
- I used page.accessibility.snapshot() to retrieve the accessibility tree and find the node ID.
- Attempted to use page.evaluate() with the retrieved id, but it’s unclear how to map this back to the actual DOM element.
- Explored using ARIA roles (role: "button") and names (name: "Recherche Google"), but this doesn’t guarantee matching the specific node.
I expected to interact with the element using the node ID or any accessible path, but I haven’t found a reliable way to map the accessibility node ID to a clickable element in Puppeteer.