Get Attribute: The UI element is invalid. Make sure the target application is open and the element is on the screen

In the Main sequence, I am using for each to loop selections from drop down list and I have used “If” activity to make sure that the text is written without spaces in the beginning or end of string

The first iteration passes correctly. However, the second iteration gives me this error.

Selector Changes : Check if the selector you’re using to identify the dropdown list has changed between the first and second iterations. If the selector is dynamic, it might require adjustments to correctly identify the element in each iteration.

UI layout or structure can change between iterations. Ensure that the UI elements you’re interacting with, like the dropdown, remain consistent across different iterations.

You can use the debug mode & slow step between the iteration to check where it is failing

I am debugging however I cannot detect the problem it is just failing in the second iteration

Hi @Ibrahim_El_Galfy ,

Could you let us know if the If activity is really necessary here, as we can use the Assign activity itself to update the text with the Trimmed spaces using Trim method :

text = "Arabic Text".Trim

Could you check with this in place without the If activity. Sometimes we would require to also keep the spaces in the values so that it matches exactly as in the UI Element. A verification could be done by using default values in the variable and checking whether each element value that needs to be selected is getting recognised correctly.