Exception to run "For each" activity in my RPA project

Hi, I designed the “For each” activity as follow:

Here is the exception I got when run the “For each” activity, could you help me check where is wrong?

22.10.3+Branch.master.Sha.def2351dc828ccfbcddb6e9e07c9cf71b5bf55da

Source: For Each UI Element

Message: Could not find the user-interface (UI) element for this action.

Possible solutions:
• Ensure application is opened and the UI element is visible on the screen at execution time
• Edit the Target of the UI activity and use Validation to debug the issue.
• If needed, re-indicate the element as its properties might have changed
• Use “Check state” activity to check the application state before executing the action
• Increase the “Delay before” value to allow time to the application to render entirely and become responsive

Exception Type: UiPath.UIAutomationNext.Exceptions.NodeNotFoundException

UiPath.UIAutomationNext.Exceptions.NodeNotFoundException: Could not find the user-interface (UI) element for this action.

Possible solutions:
• Ensure application is opened and the UI element is visible on the screen at execution time
• Edit the Target of the UI activity and use Validation to debug the issue.
• If needed, re-indicate the element as its properties might have changed
• Use “Check state” activity to check the application state before executing the action
• Increase the “Delay before” value to allow time to the application to render entirely and become responsive at UiPath.UIAutomationNext.Activities.TargetCommonLogic.GetSearchResultAsync(IRuntimeContext runtimeContext, ITargetAnchorable target, CancellationToken token)
at UiPath.UIAutomationNext.Activities.TargetNativeBase.SearchNodeAsync(IRuntimeContext runtimeContext, ITargetAnchorable target, CancellationToken token)
at UiPath.UIAutomationNext.Activities.NForEachUiElement.<>c__DisplayClass70_0.<b__3>d.MoveNext()
— End of stack trace from previous location —
at UiPath.UIAutomationNext.Activities.Helpers.UiNodeInfoEnumerator.ExtractToDataTableAsync(CancellationToken token, Int32 processedRows)
at UiPath.UIAutomationNext.Activities.Helpers.UiNodeInfoEnumerator.InitializeAsync(CancellationToken token)
at UiPath.UIAutomationNext.Activities.Helpers.UiNodeInfoEnumerator.MoveNext()
at UiPath.Shared.Activities.Business.ForEachEnumeratorExtensions.Iterate[T](Variable1 enumeratorVariable, NativeActivityContext context, ActivityInstance completedInstance, Boolean exitLoop, Action1 doAction, Action1 completedAction, Action1 exitAction)
at UiPath.UIAutomationNext.Activities.NForEachUiElement.ExecuteForEach(NativeActivityContext context, ActivityInstance completedInstance)
at UiPath.UIAutomationNext.Activities.NForEachUiElement.<>c__DisplayClass70_0.b__1(NativeActivityContext resumeContext)
at UiPath.Shared.Activities.AsyncTaskNativeImplementation.BookmarkResumptionCallback(NativeActivityContext context, Object value)
at UiPath.Shared.Activities.AsyncTaskNativeActivity.BookmarkResumptionCallback(NativeActivityContext context, Bookmark bookmark, Object value)
at UiPath.Shared.Activities.ContinuableAsyncNativeActivity.BookmarkResumptionCallback(NativeActivityContext context, Bookmark bookmark, Object value)
at System.Activities.Runtime.BookmarkCallbackWrapper.Invoke(NativeActivityContext context, Bookmark bookmark, Object value)
at System.Activities.Runtime.BookmarkWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

@guomin.li,

Tried these suggestions?

Ensure application is opened and the UI element is visible on the screen at execution time
• Edit the Target of the UI activity and use Validation to debug the issue.
• If needed, re-indicate the element as its properties might have changed
• Use “Check state” activity to check the application state before executing the action
• Increase the “Delay before” value to allow time to the application to render entirely and become responsive

Also to print any attributes of the UI element, use Get Attributes activity which will return you the desired attribute and then log it or use it in another activity.

Hi @guomin.li
You can,

*Check UI Visibility: Ensure the application and UI elements are open and fully visible before running the “For Each” activity.
*Re-validate Selector: Re-indicate the target UI element to refresh the selector if the UI structure has changed.
*Add Delay: Increase the “DelayBefore” property in the activity to allow time for the UI elements to load.
*Use “Check State”: Add a “Check State” activity to confirm that the application is ready before iterating through UI elements.

Hope this helps!