cancel
Showing results for 
Search instead for 
Did you mean: 

Get text from popup warning

Leahy
Contributor

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 8
Leahy
Contributor

Re: Get text from popup warning

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);

cunderw
Community Hero

Re: Get text from popup warning

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. 


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
tristaanogre
Community Hero

Re: Get text from popup warning

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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
TanyaYatskovska
Community Manager

Re: Get text from popup warning

Hi @Leahy,

 

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

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Leahy
Contributor

Re: Get text from popup warning

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
Community Hero

Re: Get text from popup warning

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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Leahy
Contributor

Re: Get text from popup warning

Thanks Robert,

 

I just spent the last couple of hours pouring over the "Properties" (I also searched "Methods" and "Fields").  The text that I want to capture is nowhere to be found.  I guess I will just have to use the window name...

thanks again for your help,

 

Lee

tristaanogre
Community Hero

Re: Get text from popup warning

The text may not be immediately available in a property of that window.  If there is a property like "items" that is an indexed array, it could be that "item[0]" contains the desired text.  


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
New Here?
Join us and watch the welcome video:
Announcements