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):
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?
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”
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:
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.
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.
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/…)
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.
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