Problem retrieving data from a table
-
Hi Allan,
I have a problem with a table that gives back too much data.
Instead of the value of one cell it returns all the values of the whole row in 1 string.
This is the table:
This is my RPA part:
The selectors look like this:"xpath": "/html/body/form/div[4]/table/tbody/tr/td[1]/table/tbody/tr/td/div/div/div[2]/div[2]/div[6]/div[1]/table/tbody/tr" and "cssselector": " td:nth-child(2)"
And this is the output:
[08:32:51.878][Output] GetVesselData completed in 00:01.582 [08:32:51.874][Output] NAme: APL MERLION 9632014 - - [08:32:51.363][Output] NAme: XOBSELETE DUPLICATEAPL MERLION - - [08:32:50.842][Output] NAme: Link Name IMO Obsolete Nationality
I wrote NAme like that on purpose. A colomn header is also named 'Name'.
The first result is actually the header of the column. I don't see that in my other table grabbers.
Do I do something wrong, or did I hit a bug?
Kind regards,
Rutger van Schoonhoven
(I removed the ToString() part in item.Value.ToString(), but that changes nothing.) -
So here is what you are suppose to do.
- add a Get Element that grabs all the <tr>'s set MAxResults to something big.
- Inside the Get Element add another one or more Get Element and get the <TD>'s you need
That way the second Get Element will be called one time per row
In your screenshot you are not doing anything with the nested get element, so item will contain the ROW not a specific cell.
Also, for html, it's often better to use item.Text than Item.Value, but you can play around with both and see what works best for you.
-
@allan-zimmermann
As usual the bug is found between the sceen and the backrest of the chair. (feeling stupid)
Thanks Allan. -