Hello!
I try to make a sample of automation project (Win32 app) and have a troble.
I have a small form with small table (2 columns, 3 rows).

An I have next C# code to get all elements of this table:
Collection<ReadOnlyCollection<WindowsElement>> VersionsList = new CollectionReadOnlyCollection<WindowsElement>>();
ReadOnlyCollection<WindowsElement> y = null;
int k = 1;
string DataPath = $".//Custom[@Name=\"Items row {k.ToString()}\"][1]/DataItem";
do
{
y = null;
y = session.FindElementsByXPath(DataPath);
if (y.Count != 0)
{
VersionsList.Add(y);
k++;
Console.WriteLine($"Current state VersionsList: {VersionsList.Count.ToString()}");
DataPath = $".//Custom[@name="Items row {k.ToString()}"][1]/DataItem";
}
}
while (y.Count != 0);
When I run this code in Debug mode (with brake point) and execute all rows in sequence (Step Into or Step over it's doesn't metter) all works excellent.
When I run test not in debug mode it always find elements without last row ("Items row 3").
I try find this element with another code (before the cycle starts):
y = session.FindElementByXPath($".//Custom[@Name=\"Items row 3\"][1]/DataItem")
But i have the same result in both cases (debug and run).
How can I find last row in run mode?
I will be grateful for any help.
Hello!

I try to make a sample of automation project (Win32 app) and have a troble.
I have a small form with small table (2 columns, 3 rows).
An I have next C# code to get all elements of this table:
When I run this code in Debug mode (with brake point) and execute all rows in sequence (Step Into or Step over it's doesn't metter) all works excellent.
When I run test not in debug mode it always find elements without last row ("Items row 3").
I try find this element with another code (before the cycle starts):
y = session.FindElementByXPath($".//Custom[@Name=\"Items row 3\"][1]/DataItem")But i have the same result in both cases (debug and run).
How can I find last row in run mode?
I will be grateful for any help.