I have an issue with playwright, when i loop through let's say a tbody or something like that then change the page do something and get back to the original page i get this error
============================================================
name='Error
stack='Error: Element is not attached to the DOM
=========================== logs ===========================
I don't know how to fix this without changing all my code
Source code: https://github.com/AIGLEZMA/mmsp-simulator The website: https://simulation.mmsp.gov.ma/salaire/pages/home.mmsp?localeCode=fr
Basically i loop through all the "Catégories", "Corps", "Cadre", "Grade", "Indice-Échelon" then click on "Suivant" (next) get the data I want and click on previous button, BUT it doesn't finish looping through those "Indice Échelon" any suggestions ?