Forum Discussion

llaskin's avatar
llaskin
Occasional Contributor
15 years ago

not able to find firefox all of a sudden?

As you can see from the attached screenshot, firefox is open.  The process name is firefox, and firefox is mapped via name mapping to Sys.Process("firefox").  However as of this morning, I am unable to "find" firefox when I try to highlight it on screen(or reference it via my automation).



Please advise.



--L

3 Replies

  • Hi Leo,


    Please note that you are trying to highlight a process, not a window. So, the result you get is quite natural, because a process is not a visual object which can be highlighted.


  • llaskin's avatar
    llaskin
    Occasional Contributor
    Allen,

    It worked fine before.  The fact that I can't find firefox now causes my tests to fail to run.  I can't highlight anything else that is beneath the firefox name mapping tree anymore either.
  • Hi Leo,


    To help us investigate the problem, please follow the steps below:


    1. Insert the following routine call before retrieving the problematic object in your test (change the process name):


    LogAppStructure(Sys.Process("firefox"))


    Here is the LogAppStructure routine code:


    [VBScript]


    Sub LogAppStructure(obj)

      Err.Clear

      On Error Resume Next


      Dim count, i, Str

     

      ReDim params(7)

      params(0) = "WndClass"

      params(1) = "WndCaption"

      params(2) = "Index"

      params(3) = "Visible"

      params(4) = "Exists"

      params(5) = "ClrFullClassName"

      params(6) = "ProductName"

      params(7) = "ProductVersion" 

     

      Str = ""

      For i = 0 To UBound(params)

        If IsSupported(obj, params(i)) Then

          Str = Str & params(i) & " = " & VarToStr(Eval("obj." & params(i))) & VbCrLf

        End If

      Next

     

      Call Log.AppendFolder(obj.Name, Str)

      For i = 0 To obj.ChildCount - 1

        Call LogAppStructure(obj.Child(i))

      Next

      Log.PopLogFolder


      On Error GoTo 0

    End Sub


    [JScript, C#Script]


    function LogAppStructure(obj)

    {

      var count, i, Str;

     

      var params = new Array();

      params.push("WndClass");

      params.push("WndCaption");

      params.push("Index");

      params.push("VisibleOnScreen");

      params.push("Exists");

      params.push("Visible");

      params.push("FullName");

      params.push("ClrFullClassName");

     

      Str = "";

      for (var i = 0; i < params.length; i++) {

        if (IsSupported(obj, params))

          Str += params + " = " + VarToStr(eval("obj." + params)) + "\r\n";

      }

     

      Log.AppendFolder(obj.Name, Str);

      for (var i = 0; i < obj.ChildCount; i++) {

        LogAppStructure(obj.Child(i));

      }

      Log.PopLogFolder();

    }


    2. Execute your test and reproduce the "Object not found" problem. The LogAppStructure function will post the entire structure of the tested application to the test log, and you will be able to see how objects are recognized right before the problem occurs.

    3. If you fail to find the cause of the problem by using the test log, zip your entire TestComplete project suite folder along with the log of the test execution and send us the archive via our Contact Support form (http://www.automatedqa.com/support/message). Make sure that messages in your log correspond to the correct actions in the latest version of your test.


    BTW, please note that mapping an object by its FullName property is meaningless as it is the same as addressing the object by its full name, and the property may not allow you to identify an object reliably if the object in question and/or its parent object(s) have variable name(s) (for example, one (or more) of the objects is (are) identified by index). I recommend that you use the ProcessName property to identify the particular object shown in your screenshot.