Get text last element

Hi team,
i need to get text the last element of a table, this is the selector:

webctrl id=‘j_id0:j_id420:j_id421:j_id544:invoices:j_id640:j_id641:j_id642:6*’ tag=‘SPAN’ idx=‘1’ /

I don’t know how many rows i have, sometimes 3, sometimes 7, how can i get always the last one?
Many thanks in advance

First, screen scrape the data into a datatable.

Next, if DtData is your datatable, you can get the last row of data with DtData.Rows(DtData.Rows.Count - 1). This is a DataRow type object.

2 Likes

Yes, this works, thanks.
Is impossible to do with the selector?
In my experience, probably i’m wrong, not always the screen scraping has 100% accuracy

There is another way, but it involves checking for existing elements until one doesn’t exist. Most tabular data has an id, which you can use dynamically in the selector. You would just increment the id until you find one that doesn’t work. That way, you know the id before that is the one for the final element.

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