Not finding correct selection

How can we find the Correct element to Right Click?

Have tried to select element for right click but it get selected on incorrect element

Thanks for your suggestions!!!

Hi @anmita,

I think the idx here is leading you to the error. If this field is too volatile, set a selector that will remove this idx.

<uia automationid='pTree' cls='*' idx='*' name='pTree' />


Hello @anmita

here id cls and idx is not mandatory you can omit from selector. Inspect on that element using uiexplorer and keep only the static values. Also name=‘{{OptionSelected}}’ , have you checked the variable “OptionSelected”. Is it holding the correct value without any unwanted spaces?

Suggesting to fine tune the selector using Uiexplorer.

Hi @muhammedyuzuak
I tried it by removing the idx that did not work


Hi @Rahul_Unnikrishnan
Yes I tried removing idx as well as cls.
And for variable the value contains spaces between word do you think that could be the reason we are not able to select the correct value?


Hi @anmita ,

It would be best if you could provide us the Screenshot of the Selector in UiExplorer, when the Element is Valid. This would help us find the right attribute for your selector.

@anmita yes that can be the reason. Use that variable.trim to remove the unwanted spaces and pass it to selector.

OptionSelected.trim The below post will help you.

Hi @Rahul_Unnikrishnan
When I assigned it this way then the selector fails to validate

No…This is wrong…

Using assign activity , OptionSelected=" ANQ by Date "
use another assign activity , OptionSelected=OptionSelected.Trim.ToString

Just deleting it is not enough. You need to ensure that it does not get idx by adding different unique values ​​in that row. @anmita

@anmita Can you try below steps

  • Take a separate sequence (Since I don’t want to disturb your current code) and take click activity
  • Indicate the element, open the selector in UiExplorer, and see is there any aaname. If it has then enable that into your selector
  • Now, disable cls, idx from your selector
  • Validate, and perform click through bot. If it is working then try to pass the variable into your selector and check the results
1 Like