I have a question regarding \"Element is no longer attached to the DOM\".
I tried different solutions but they are working intermittent. Please suggest a solution th
https://www.swtestacademy.com/selenium-wait-javascript-angular-ajax/ here is a good article about dynamic waiter strategies. Your problem is not waiting properly all the ajax, jquery or angular calls. Then you end up with StaleElementException.
If your approach is to use Try-Catch mechanism, I guess it has a flaw. You shouldn't rely on that structure as you'll never know it's gonna work in the catch clause.
Selenium gives you the opportunity to make javascript calls. You can execute
commands just to check the existence and states of those calls.
You can do that before any findBy operation so you always work with the latest page