Leahy
6 years agoContributor
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.
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);
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.