[Question] Element is not attached to the DOM
See original GitHub issueHello,
I have a script like this.
I randomly get Element is not attached to the DOM
error when I run this.
await page.waitForSelector(selector);
const element = await page.$(selector);
await element.click();
Is it possible that the element disappears between the $ command and the click? If yes, how can I prevent this issue?
Thanks, Andras
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Playwright "Element is not attached to the DOM" - Stack Overflow
The element is selected successfully, but then when trying to run await input.CheckAsync() , I get the error Element is not attached to...
Read more >webdriver - "Element is no longer attached to the DOM ...
An element that is found on a web page referenced as a WebElement in WebDriver then the DOM changes (probably due to JavaScript...
Read more >Exceptions | Selenium
The element has been deleted entirely. The element is no longer attached to the DOM. The Element has been deleted. The most frequent...
Read more >Using shadow DOM - Web Components | MDN
Shadow DOM allows hidden DOM trees to be attached to elements in the regular DOM tree — this shadow DOM tree starts with...
Read more >Stale Element Reference Exception in Selenium Webdriver ...
Cause 2: The referenced element is no longer attached to the DOM ... Assume a document node is removed from the DOM, its...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for the explanation @dgozman. Makes sense, I’ve thought it works this way.
Let me close this issue then. If you have any more questions, please comment here, and I’ll reopen.