Multiple similar elements with same attributes | How to differentiate?

Hello All,

I have a scenario where a single page has two similar icons (lets say Search icon).

Both search icon is having same attributes (aaname, innertext etc).

For example, lets assume search icon is present near Name textbox and Address Text box. Now, I want to locate the search icon near address text box. How to differentiate between two icons here?

On indicating, only idx value differs. Is there a way we can specifically locate the icon near address text box without depending on idx value?

Looking forward for a solution. Thank you.

hi, @shahidhaqeel.s

use Anchor Base or Find Relative Element activities. Anchor the selector to the Address textbox or its label, then find the icon relative to that anchor.

Hi @shahidhaqeel.s

try with Anchor Base activity ,Set a nearby unique element like the “Address” label or textbox as the anchor. This helps identify the correct icon based on UI layout rather than index.

Happy Automation

Hi @prashant1603765

Even though Anchor is selected, when idx value is removed, control moves from Address Text box Search to Name Text box Search icon.

Is there any way we could solve this please?

Hi @arjun.shiroya

Even though Anchor is selected, when idx value is removed, control moves from Address Text box Search to Name Text box Search icon.

Is there any way we could solve this please?

@shahidhaqeel.s it means the selector is not unique enough. To fix this, use UiExplorer to find a stable, unique parent or sibling attribute near the Address textbox (like a container ID, class, or label text) and include it in the selector along with the anchor try to fine tuning the selectors

Hi @shahidhaqeel.s

Are you using classic activities?

If using modern, those already have an option to select the anchor to help identify the element uniquely.

For e.g. click activity would have target as well as anchor in there. Also, the modern activity uses various methods(CV/image/fuzzy/strict) to identify the element properly.

i would suggest to identify element using modern equivalent and then select different anchors for different text boxes, should work.

Use Strict Seletor, Fuzzy selector and Image and add anchor too and check or else try exploring UiExplorer to findout one key property that is different

@shahidhaqeel.s

Indicate the element in ui explorer

then in center top window try to move from bottom to top one level at once and check which line talks about the related name or address fields and select that line to make the selector for both searches unique

so your selector might look like this

<webctrl tag='DIV' innertext='name' />
<webctrl tag='Input' type='Text' />

this is an example follow above steps and get a unique selector for each

cheers

@shahidhaqeel.s Try providing anchor selection using CV(Image region selection) bcz the selectors are not reliable to identify a specific element it can identify the element using its visual appearance