Forum Discussion
- baxatobCommunity Hero
Hi,
Please provide more details - what kind of popup message? What is the error? The piece of code from where error comes etc.
- EvgenyTitovOccasional Contributor
Added mapped object pic
- tristaanogreEsteemed Contributor
Two things:
1) TestExecute doesn't do any mapping... it uses whatever mapping has been applied to the object in TestComplete
2) As baxatob, this object is currently not mapped at all. If you think this is in error, please provide a screenshot of the mapping criteria used for this message box.
- baxatobCommunity Hero
So how it fails? What kind of issue have you faced with?
Currently it looks like unmapped element.
- EvgenyTitovOccasional Contributor
Hi, sorry for lack of details.
We use Visual Studio as framework for testing.
string FatherExp = "NativeClrObject.Name=[PmsMessageBox];Visible=True;SearchDepth=5";
This is exp for root (process): var rootNode = driver.WaitProcess("WorkflowHost", 120000);
This is exp for popup: var messageBox = driver.WaitObject(rootNode, FatherExp, 300000);
- baxatobCommunity Hero
OK, can you provide the code for this method: WaitObject(rootNode, FatherExp, 300000)
And again - did you receive any error during the runtime?
- EvgenyTitovOccasional Contributor
Hi, there is no error , just exit after timeout.
public var WaitObject(var rootNode, string stringExp, double timeOutMilliSeconds)
{
var obj;
DateTime startTime = DateTime.Now;
obj = FindChild(rootNode, stringExp, "");
if (obj != null)
{
return obj;
}
while (timeOutMilliSeconds > ((int) (DateTime.Now - startTime).TotalMilliseconds))
{
obj = FindChild(rootNode, stringExp, "");
if (obj != null)
{
return obj;
}
Thread.Sleep(50);
}
return null;
} - EvgenyTitovOccasional Contributor
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;
}
}- baxatobCommunity 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.