Playwright error

Error: locator.click: Element is not attached to the DOM

The element you were about to click got unmounted and remounted between when it was found and when the action fired.

Why this happens

How to fix it

  1. Prefer Locators (`page.locator(...)`) over a cached `ElementHandle`, since Locators re-resolve the DOM on every action automatically
  2. If you're calling `page.$()` anywhere, switch that call to the Locator API