UIElement is no longer valid - while using Inject JS activity

Hi All, i’m frequently getting UIElement no longer valid error. however if i use delay activity before my target activity, it is working. but i don’t want to use Delay as it would increase my Execution time.

i have tried removing cookies and everything, nothing worked.

browser i’m using is IE

When debugging, ensure that the selector is still valid. If it is not, you will need to modify your selector to more precisely find the attribute. If it is valid, use the Retry Scope activity to have the activity retry until something on the page changes which indicates success. Typically, an Element Exists is used in the Condition block of the Retry Scope activity to find the condition.

its not about element loading actually. elements are loaded fine. let me give you one scenario.
I have 2 Inject JS activities in a single sequence with same selector.
first activity is working, for second activity im getting UIElement is no longer valid error. even though the page is already loaded.

maybe it is reloading or refreshing the elements in the background…

Check if there is something dynamic changing between the two items. It may be that the 2nd item has a slightly different attribute than the 1st.