Invalid element state error and delay solution

Hi everyone,

Has anyone found an optimal solution for this invalid(stale) element exception? This happens primarily in javascript forms with many pages that reuses the same web elements.

Root cause: org.openqa.selenium.InvalidElementStateException: invalid element state: Element is not currently interact-able and may not be manipulated

I am currently working around this problem by adding a delay between each keyword that reuses an element and henceforth causing the stale element exception. Although this works, I do not believe it to be the most optimal/desired solution as relying on hard delays might introduce too many variables such as when a website doesn’t load as fast as usual.

Other solutions I have tried include using the wait until the element is clickable keyword. Unfortunately this fails immediately as Katalon is unable to find the element in the first place if a stale element exception occurs. I also tried using the Javascript click, but that yields the same result as the waitElement attempt.

Hi Jack

Your issue can be solved, but I’ll need to understand better how your pages are constructed.

What technology is used to submit forms to the server? (Hint: technically, there is no such thing as a “JavaScript form”.)

I also tried using the Javascript click, but that yields the same result as the waitElement attempt.

I’m a little surprised that didn’t help but maybe I’d understand better if you explained what you mean by “same result” – a JS click should never result in a stale element error.

Post some of your HTML, your test code and errors and anything else you think relevant.