NForEachUIelementアクティビティを使い、ボタンを上から順番にクリックしたい

こんばんは
UiPath Studio 2025.0.176STS Community editionのユーザーです。

1.やりたいこと

NForEachUIelementアクティビティを使い、ブラウザのボタンを上から順番にクリックしたい。

2.悩んでいること

NForEachUIelementアクティビティの中にNClickアクティビティを置いて、厳密セレクタをNForEachUIelementアクティビティとNClickアクティビティの両方に下図の通り設定してみましたが、動きませんでした。エラーメッセージは出ていません。何がまずいのでしょうか?


hi @gorby ,

The issue is using a fixed selector in NClick inside NForEachUIElement, which ignores the loop’s current element

In NForEachUIElement : Target the table (id=‘wish-list’ ), filter to IMG buttons (no specific wish-del-* ID).

In NClick : Remove selector set Target to currentElement (loop variable)

@arjun.shiroya, Thank for your swift reply!
However, I do not understand how to make the next codes.

Target the table (id=‘wish-list’ ), filter to IMG buttons,set Target to currentElement

Could you show me code sample?

@gorby

Use NForEachUIElement inside a Use Browser activity for your Chrome wish-list page

Step 1: Configure NForEachUIElement:

  • Drag NForEachUIElement (modern activity).
  • Click Indicate on screen → Select the TABLE (id='wish-list').
  • In wizard: Check all IMG delete buttons; uncheck others. Confirm.​​
  • Properties → Limit (optional): Set to 0 for all buttons.

Step 2: Configure NClick Inside Loop:

  • Drag NClick inside NForEachUIElement body.
  • Delete any selector in Target field (clear it).
  • Target field → Click + → Use variable → Select currentElement (auto-generated loop variable).​​
  • ClickType: Single, MouseButton: Left.

Test- Run in Debug: Watch Locals panel— currentElement.Selector changes per button (top-to-bottom).

After building the workflow as you instructed, I encountered the error below. Do you know the cause?

繰り返し (各 UI 要素) ‘繰り返し (各 UI 要素)’: Error HRESULT E_FAIL has been returned from a call to a COM component.

@gorby

HRESULT E_FAIL = Corrupted selector.
Delete NForEachUIElement completely

Drag New NForEachUIElement → Indicate TABLE (wish-list) only → Next

Wizard: Check ALL delete IMG buttons → Confirm

Inside: NClick Target = currentElement (no selector)

Project Settings → UI Automation → Strict Selector = OFF

Debug → Step Into → Locals Panel → currentElement.Valid = True

If Valid=False, page changed—add Delay 1s or 2s before loop

Let me confirm,

Should I choose only one button (despite I can choose all buttons)when I set selector in NForEachUIElement activity?

@gorby

NO - Select TABLE (wish-list) as Target, then check ALL delete IMG buttons in Wizard

Correct Steps:

NForEachUIElement → Indicate TABLE (not single button)

Wizard opens → Check every IMG delete button (multiple ✓) → Confirm

This creates list for looping top-to-bottom

Single button = loops only 1 time.
All buttons = loops all buttons

Cooul you show me how to indicate table (wish-list) in property of NForEachUIelement activity? This activity does not allow us to set character parameter is my problem.

Click the “Indicate” button (target icon) INSIDE the activity body in Designer panel—not Properties panel.

Target field stays empty

Indicate → Select entire wish-list TABLE

Wizard → Check all delete IMG buttons → Confirm

Properties auto-fill after. No typing needed.

How can I start Wizard? It is ambiguous the gap between indicate and Wizard.

Press F2 during Indicate on Screen—it pauses selection for 3 seconds, letting you switch between wizard modes clearly.

Or Restart Wizard:Cancel current Indicate (Esc key).

Click Indicate again → Studio refreshes options.

Select exact target type (UI Element/Region).