How to Resolve Duplicate elements Found Issue

Hey everyone, I am trying to copy the data by clicking the copy to clipboard button. But when I have 2 copy to clipboard buttons appeared in the chat it throws an error because there are multiple elements (Duplication of element error). Could anyone please help me out how can I resolve this issue?

Attached herewith is a sample screenshot for more clarification.

@Muhammad_Anas_Baloch

  1. Identify unique attributes: Check the HTML source code of the webpage or application to identify attributes that uniquely identify each copy to clipboard button. Attributes such as “id,” “name,” “class,” or any other attribute that uniquely distinguishes the buttons can be used in the selector.
  2. Modify the selector: Update the selector of the “Click” activity for each copy to clipboard button to make sure it targets the specific button you want to click.
1 Like

I cannot do it that way because I have a huge stuff to search and copy the details and paste it back to Excel. Once I will stop the script and RUN it again at that time It will again try to find the element ID which was inserted in the script at the beginning which means if in the beginning we give the ID 5 it will work fine for the first time.

When I will execute it next time the element may be 115 on the webpage because of the previously generated responses but when the BOT will try to find copy to clipboard with the element ID 5.

I just want to click on the last copy to clipboard button.

@Muhammad_Anas_Baloch

Use strict selector disable fuzzy selector and image
If you add anchor it will identify the copy to clipboard uniqly

1 Like

If you want to click the last one, use Find Children, set to FIND_DESCENDANTS, and then for the output array (let’s say you named it buttonArray) you use buttonArray.Last as the input element for your Click activity.

1 Like

If you want to copy the data that is most latest, you can use the click activity and set anchor as the input box of chatgpt or make the selector dynamic to only select that particular button

1 Like

Strict Selector contains the IDX number.

Will try it for sure.

I tried to make it dynamic but it failed. I will try your second suggestion.

Hi @Muhammad_Anas_Baloch

When you are indicating the element in the browser check the strict selectors and uncheck the fuzzy selectors and image.

Hope it helps!!

2 Likes

By the way, there are better ways to use ChatGPT with UiPath than using UI automation.

1 Like

If it is working for you @Muhammad_Anas_Baloch, Let me know.

If it’s not worked we will try with another method.

@mkankatala, @rlgandu here is the code of strict selector.

<webctrl css-selector=‘body>div>div>div>div>main>div>div>div>div>div>div>div>div>div>p’ idx=‘5’ isleaf=‘1’ tag=‘P’ />

In this code you can see idx=‘5’ which means when BOT will generate next result the idx will be idx=‘6’ and BOT will throw an error that UI element not found.

IDX is not an stable attribute it will change every time we have to check the attribute which are unique for that element.

Try to indicate 3 to 4 times, if the idx value is same then consider the idx value.

Take a assign activity and store the idx value in a variable and pass that variable in the strict selectors in the ui explorer window.

Hope you understand!!

Yes that will work for the first time. When I will stop the BOT and start it again on chatGPT thread the IDX id will be for instance 36 but we assign the IDX as 5 in the assign activity in the beginning in this case my BOT will fail.

I already said about this in above reply. The IDX value is not stable variable we cannot use in this.

Then try to use another attribute which are unique.

Could you indicate the element once and send me the screenshots of the attributes which are available in the ui explorer for that element.

1 Like

@mkankatala

Try with uncheck the CSS selector, isleaf and remove the idx.

Check the tag is constant in every time

1 Like

@Muhammad_Anas_Baloch

Add anchor to the uielement so that it will identify the target copy to clipboard.

1 Like

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