Hello,
I am trying to get the src attribute for an image, that is inside a table.
The table can have multiple rows, it is dynamic, and in each row there is always a text in the first column. Next to the text, there can be an image or not (2 different kind of images or ‘icons’).
I can do a foreach for every single row, but, since the image selector is not distinctive enough, I have not found any way to create the selector with the UiPath selectors, not getAttribute activities, because there is no way to tell if the row is the first one, second one, or whichever.
Now, I have found a way to make it work by creating a xPath, trying it out on the Google Chrome console. The XPath selector is the following one:
//span[contains(text(), ‘Y71A-234B3’)]/…/…/td[contains(@class, ‘general’)]/img[contains(concat(’ ', normalize-space(@src), ’ '), ‘resources/inc’)]/@src
As you can see from the xPath selector, “Y71A-234B3” is the row text, that would have to be passed as an input. As I said before, I have previously made a data scrapping from the website, and I am inserting every row text as an item to a collection (making sure not to repeat the elements). That is the reason why I just need to loop through the collection items now in a foreach, getting the src from the image in every iteration.
The issue is that I do not know how to get the expected result from the image in every iteration of the loop, since I have only made it work with an xPath.
Can you please tell me how to transform the xPath that was sent into a selector that is “understandable” by UiPath, for example, to a “css-selector”? How can I reference the “parent” using a css-selector, so that I can just reference the row name, then go up to the parent row, and go down again looking for the image in the HTML DOM? (the way I did it in the xPath).
Thank you.







