I develop automated tests using MS VS 2012 and CodedUI. Our application contains number of teleriks gridviews. For test purposes I need to obtain every row from those gridviews, but the problem is I can only obtain limited number of rows due to virtualization. Tried scrolling new rows into view to realize them and adding them to array/collection
code snippet:
code works ok when i'm debugging, but when i'm just running the test resulting array is mess, the same ~10 rows repeats again and again
What's wrong with this code? Is there any other reliable way to get all the data from virtualized grid?
code snippet:
// determine viewport, i.e. how many rows are accessible for that specific panel
for
(
int
m = 0; m < 50; m++)
{
try
{
if
(!hGridView.GetRow(m).Exists)
{
}
}
catch
(UITestControlNotFoundException)
{
viewPort = m - 1;
break
;
}
}
// no extra scrolling required, all rows are accessible
if
(rowCount <= viewPort + 1)
{
for
(
int
m = 0; m < rowCount; m++)
{
rows_output[m] = hGridView.GetRow(m);
}
return
rows_output;
}
//get all accessible rows before scrolling to expose the rest
for
(
int
m = 0; m <= viewPort; m++)
{
rows_output[m] = hGridView.GetRow(m);
col1.Add(hGridView.GetRow(m));
}
for
(
int
m = 0; m < viewPort; m++) { Keyboard.SendKeys(
"{DOWN}"
); }
for
(
int
i = 0; i <= rowCount - viewPort - 2; i++)
{
try
{
// check the row to add isn't a duplicate
if
(!col1.Contains(hGridView.GetRow(viewPort)))
{
col1.Add(hGridView.GetRow(viewPort));
}
rows_output[i + viewPort + 1] = hGridView.GetRow(viewPort);
}
catch
(UITestControlNotFoundException)
{
// if for some reason gridview becomes inaccessible
break
;
}
//scroll the grid down a bit
Keyboard.SendKeys(
"{DOWN}"
);
}
What's wrong with this code? Is there any other reliable way to get all the data from virtualized grid?