Wildcard * not working on selector

Good day to all,

I am working on a project where I need to get some information from a website. In this case I access this link where there is a video embedded like this:

Below it, higlighted with the red square, is the information I need to obtain from the website. This information is dynamic because the content of the video and the information below changes during the day.

This is the selector that I’m trying to adapt (before changes):

And what I’m trying to do is the following:

As you can see, I have added a wildcard in href after “athletes/” and in the url after “.com/” and the selector fails to find the element. Could you try and help me with this issue? I’m not understanding why this is the case because it should work, right?

Thanks a million.

In the screenshot - * is not added in the URL

Please confirm the same

Also Since we have IDX info - Kindly make href completely as * and give a try

Also make the changes in the URL first and validate. If it is working fine - try changing in href

Let me know your findings

Apparently your selector is too ambiguous to select one specific element in the web page. It is indicated by the use of “idx” attribute that is added by UI Explorer when other attributes do not offer adequate uniqueness.

e.g. idx=‘6’ gives you your desired element but idx=‘7’ gives you “Tatiana Weston-Webb”


So in principle any selector containing “idx” is rather unstable and should be avoided.

Cheers

Please check the screenshot in the bottom, the URL has the * wildcard and I have pressed the validate button to check the selector.

This is the selector without adding the wildcard in the URL

And this is the selector when added the wildcard

In the href i specifically added the wildcard after “athletes/” because I need to differentiate when the information is either athletes of a sport.

Hi @ulises.ariza

Would you like to click the first element in the list of names.?

I thought the idx was used when the ambiguity of the selector made UiPath to say “ok, this is item number X with this similar selector information”.

In this case, what I want to obtain is the information of this item.

In this case, there are multiple items like the one highlighted which all are the name of atheletes but it could be just one item with the name of the sport, like in this screenshot:

Or it could be two items with the name of an athlete and the name of the sport like in this screenshot:

Could there be a way to discern between all the cases with the use of wildcards? As you can see the information is very dynamic.

Hi @mkankatala

This is what the selector shows when clicking the first element after I have added the wildcard.

You haven’t given proper response to my question… @ulises.ariza

My Question is Would you like to click the first element in the list of names.?

Oh, my bad, I misunderstood your question.

No, I do not want to click it, I want to get the text from the first element and classify it either as a sport or as an athlete depending on the situation.

Correct, but the “idx” will change based on number of duplicate elements in the page. So you can’t build a stable selector using “idx”

E.g. on the other page valid “idx” is 2

I do not know what you want to achieve but probably just using wildcard will not work.

Cheers

Okay @ulises.ariza

Try using the For each UI element activity and indicate the first element. Then this will capture all the elements which are beside to it. Inside for each UI element activity insert the assign activity to store the first element. After assign activity insert the break activity to break the loop.

Then the variable which is created in assign activity will store the First element data mean name.

Hope it helps!!

I failed to explain my end goal, sorry.

What I’m trying to do if read up to two elements on that “list”, the most common cases are either one or two elements, get the text from them and classify it by athlete or sport in a datatable that I use along the process.

I was thinking on using the wildcard in the URL because it does not matter where in the olympics website I am and also in the “href” element in the selector because I need to identify if its an athlete (‘en/athlete/…’) or a sport (/en/sports/…)

I will try to do this and will let you know the result.

Thanks!

I am having an issue with the For Each Ui Element activity. When trying to choose the element I’m getting the next error message:

i have the activity inside an Use Browser activity and I have the browser open.

Have you using the for each UI element activity inside the Use application\browser activity… @ulises.ariza

Yeah I have it inside the activity. I have found that apparently the For Each UI Element needs the use browser activity to have a URL assigned to it. I had it inside another use browser in its own subprocess.

@ulises.ariza

for each ui element would do or adding a tag might also help…as if tag is not there then based on class it might choose a different type of element also and it might not have the required proeprties as well

so choose a tag as well…also if the name of the button is same then you can go with name as well…but tag would definitely help…and mostly idx might not be needed as well

cheers

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