Forum Discussion
public var FindChild(var father, string mapExp, string description) //, int numberOfIteration = 0)
{
try
{
string[] mapExpArr = Regex.Split(mapExp, "//");
int numberOfMappedObjects = mapExpArr.Length;
if (numberOfMappedObjects == 1)
{
return FindChildFromTC(father, mapExp, description);
}
father = FindChildFromTC(father, mapExpArr[0], description);
int indexOfNextFather = mapExp.IndexOf(@"//");
if (father != null)
{
return FindChild(father, mapExp.Substring(indexOfNextFather + 2), description);
}
else
{
return null;
}
}
catch (Exception ex)
{
// in case an exception was thrown from TC before VerifySuccessActionInTestComplete and the TC reported an error
if (!ex.Message.Contains("a Test Complete error was found"))
{
if (int.Parse(Connect.Log["ErrCount"]().UnWrap().ToString()) > _numOfErrorInTc)
{
_numOfErrorInTc++;
}
}
foreach (IDriverReportListener reportListener in reportListeners)
{
reportListener.ElementNotFound(description);
}
_numOfErrorInTc++; //increasing number of errors by 1 after reporting perform action exception in TC
//throw new Exception("An exception was thrown while trying to FindChild " + description + " with the mapObjExp " + mapExp);
ThrowException(ex,
"An exception was thrown while trying to FindChild " + description + " with the mapObjExp " + mapExp);
return null;
}
}
- baxatob7 years agoCommunity Hero
If no error was provided, there is no any fail :)
Looks like your method returns null , i.e. FindChild() method can't find a required object for the some reason. Check carefully what object properties it generates.
Related Content
- 2 years agoKrzysztofLach
- 6 years agopaulohg6