Forum Discussion

Leahy's avatar
Leahy
Contributor
6 years ago

Get text from popup warning

Hello, 

I am trying to capture the text on a warning popup...

 

This code seems to get everything EXCEPT the highlighted text....any help would be apprieciated.  

8 Replies

  • Leahy's avatar
    Leahy
    Contributor

    Forgot to p[ut up code..

     

    var Msgs = w.FindAllChildren("WndClass", "*", 20);

    Log.Message("Alert text: " + Msgs);

    if (Msgs.length > 0)
    { Write_Line_To_File.Write_Line_To_File("Total number of found Msgs found: " + Msgs.length,F_Name);
    for (let i = 0; i < Msgs.length; i++)
    {
    Write_Line_To_File.Write_Line_To_File("i = " + i ,F_Name);
    Write_Line_To_File.Write_Line_To_File(" WndCaption: " + Msgs[i].WndCaption,F_Name);
    Write_Line_To_File.Write_Line_To_File(" FullName: " + Msgs[i].FullName,F_Name);
    Write_Line_To_File.Write_Line_To_File(" Handle: " + Msgs[i].Handle,F_Name);
    Write_Line_To_File.Write_Line_To_File(" Name: " + Msgs[i].Name,F_Name);
    Write_Line_To_File.Write_Line_To_File(" Id: " + Msgs[i].Id,F_Name);
    Write_Line_To_File.Write_Line_To_File(" Index: " + Msgs[i].Index,F_Name);
    Write_Line_To_File.Write_Line_To_File(" Parente: " + Msgs[i].Parent,F_Name);

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      In your code, what is "w"?  The code you have is basically finding ALL child objects of "w" and looping through them.  There's nothing distinguishing saying to specifically find the message rows and the highlighted text.

      For that matter, it's entirely possible that those text lines are not actual "Objects" that can be found with "FindAllChildren".  If the component that contains them is some sort of grid object or frame or container of records, the items WITHIN that component may not be exposed to TestComplete.  What you MIGHT have to do is take a look at the container and see what properties there are in it that might be able to help you find the items.  Perhaps it has a property like "items" or "records" or something to that effect.

      Basically... it comes down to what cunderw asked for... we need a bit more information to help you more clearly.

  • cunderw's avatar
    cunderw
    Community Hero

    Without more information we won't be able to provide any assistance. We need examples of the code, your object browser for that object, any mapping you have done, Test Complete version, application type, etc... The screenshot doesn't provide any useful information to debug the issue. 

    • Leahy's avatar
      Leahy
      Contributor

      Hello Carson,

       

      I am new with Testcomplete, so I hope I understand what you are asking.  This is a desktop application (with backend SQL servers and Dbs). I am using TestComplete Ver 14.0.317.7 x64. The code is in last post, I am attaching a screen capture of Object browser.  Hope this helps.

       

      Lee

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        OK, that gives us the methods for the object.  However, simply from the hierarchy in the browser, I can see already that the individual message lines are not objects.  There is nothing in the hierarchy that looks like one of those message records.

         

        So, on that screen, go to the "Properties" tab and click the "View more members (Advanced view)" link to see all available properties.  You'll need to examine those properties to see if there's something there that contains the messages.  Look for something like "items" or "item list" or something like that.

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Leahy,

     

    Do the suggestions given here help you resolve the issue? Please mark the best post as a solution.