When I run it as part of a Test Case / Test Suite, it takes forever, but it does - eventually - work
Why would this be?
Do you know a better way of doing this?
Code: Select all
public void SelectUserFromSearchResults()
{
// this looks in the Search Results table for varSelectedUser and returns the index of this row as varIndex
Ranorex .Table myTable=repo.SelectUsersOrGroups.UsersTable.SelectUsersOrGroupsAdvanced.Table282;
IList<Row> rows = myTable.FindDescendants<Row>();
int selectedIndex=-1;
bool found=false ;
foreach (Row row in rows )
{
foreach (Cell cell in row .Cells )
{
string value=cell .Text;
if(value.Contains (varSelectedUser))
{
selectedIndex=row .Index ;
varIndex =selectedIndex.ToString () ;
found =true ;
break ;
}
if(found )
{
break ;
}
}
if(found )
{
break ;
}
}
if(!found )
{
Report.Log(ReportLevel.Failure , "Search", "Validating Exists on item 'SelectUsersOrGroups.UsersTable.Table282'.", repo.SelectUsersOrGroups.UsersTable.SelectUsersOrGroupsAdvanced.Table282Info);
}
Report.Log(ReportLevel.Info, "Mouse", "Mouse Left DoubleClick item 'SelectUsersOrGroups.UsersTable.SearchResultsGrid.SelectedDomainUsers' at 46;14.", repo.SelectUsersOrGroups.UsersTable.SelectUsersOrGroupsAdvanced.SelectedDomainUsersInfo);
repo.SelectUsersOrGroups.UsersTable.SelectUsersOrGroupsAdvanced.SelectedDomainUsers.DoubleClick("46;14");
// SelectedDomainUsers is defined in the Repository as: /table/row[@index=$varIndex]/cell[@text=$varselecteduser]
}