Find specific UIelement to click on

Hello friends.
@rkelchuri, @Rammohan91, @balupad14, @ClaytonM, @vvaidya, @Florent_Salendres, @MAHESH1,

I’ve created a workflow that cycle over the children:
1.Use Find Children Activity
2. Give the filter which is same for all the rows.
3. Next loop all the selectors and get the text.
I need, in the loop of the selectors, extract only the one with one particular ‘idx’.
The selectors are of this kind:
html title=‘Mastercom’ />
<webctrl aaname=’ ’ css-selector=‘body>div>div>div>div>div>div>div>div>div>div>div>div>div>div>div>div>div>div>div>div>div>div>div>div>div>div>div>table>tbody>tr>td>div>div’ idx=‘3’ isleaf=‘1’ parentid=‘ext-gen573’ tag=‘DIV’ /
I’ve tried in this way but doesn’t work :frowning:
ChildrenFound.Where(Function(s) s.Get(“idx”).Equals(“‘4’”))

Can you please help me?
Thank you,
Cami :slight_smile:

Hi,

I believe ‘idx’ isn’t a valid attribute for UiElement as it is a pointer in case a specific selector would return more than one element.

Assuming that your initial find childrens would give you results, you would do something like.

ChildrenFound(0) or ChildrenFound.ElementAt(0). in your case, I believe it would be index(3)

Cheers

1 Like

Thank you @Florent_Salendres.
How to filter on that specific element in the loop?
Can you please provide me a screenshot?
Thank you so much,
Cami :slight_smile:

Idx=‘“+Intval+”’

Intval → is an integer value get increment in a loop.

How to loop?

  1. Take a do while loop.

  2. Initiate loop with assign activity

IntVal = 0

  1. Initiate Boolean value with assign activity.

Start = True

  1. Initiate Boolean value with assign activity

End = False

  1. Inside the loop make increment with assign activity

intVal = IntVal+1

Put a if conditions inside the loop

Once that if conditions get satisfied then inside keep an assign variable

Start = End

Note: put Start <> End as a do while loop condition.

Hope my inputs are useful.

1 Like

You would not necessarally need a loop to target the element with idx 4.

You just need to create an UiElement variable and assign it to : ChildrenFound(0).

If you really would like to use loop for any reason, condition willl look like something:

For each elem in ChildrenFound
If ChildrenFound.ToList.IndexOf(Elem) = 3 Then
“Action”
End if
Next

Hope this makes sense.

Cheers

1 Like

Thank you so much @Florent_Salendres.
In using the assign activity with ChildrenFound(4) and I’ll let you know if it works.
Thank you so much
Cami :grinning::grinning:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.