Search code examples
web-scrapinghtml-tablerpauipath

UIPath - Get Text by position


Is there any way to get the text or UIElement from a position?

I have a table on a website that I need to fetch a cell from.

The HTML table has a column of IDs and a column of status. I am finding the ID that matches my known ID value and storing the Y part of the position. This is how I know what row I am on. Then I go to the status column with a known X coordinate.

What is the best function for me to get the Text/UIElement at those coordinates?

example (I need the status of the object with an ID of '2'):

(should return "bad")

 ID | etc | etc | Status | etc
----|-----|-----|--------|-----
 0  | ... | ... |  good  | ...
----|-----|-----|--------|-----
 1  | ... | ... |  great | ...
----|-----|-----|--------|-----
 2  | ... | ... |  bad   | ...
----|-----|-----|--------|-----
 3  | ... | ... |  good  | ...

I know you can mouse click on a position, but how can I get the text(UIElement works too) of a position?

If there is a faster/more reliable method to get the status that doesn't involve coordinates, I'm all ears


Solution

  • Your best option would be to use UiPath's data scraping feature.

    When used on an HTML Table it will return you a data table containing all of the data contained within the table.

    You can then use a for each row activity that will loop through the table.

    Inside the for each row activity, you can put an If statement with the following condition row("ID").ToString.Equals("THE ID YOUR LOOKING FOR, IN THIS CASE, 2")

    In the true section of the If statement, you can have an assign activity to get the value of the status column which can be retrieved using the following row("Status").ToString. You can leave the false section empty as this won't be needed