cancel
Showing results for 
Search instead for 
Did you mean: 

FindAll returns blank in log - help!

SOLVED
Highlighted
Contributor

FindAll returns blank in log - help!

Hi All - 

Trying to get back some data when doing the "FindAll" method.  "Find" seems to work fine and prints to the log fine.  Whenever I run FindAll, it does not give me any error - but the log is literally empty.  Can someone point out what I'm doing wrong here?  

 

This works:

function Find() {
Results = NameMapping.Sys.browser.page.nav.Find("contentText", "administrative", 1, 1000);
Log.Message(Results.MappedName);
}

 

This does not work: 

function Find() {
Results = NameMapping.Sys.browser.page.nav.FindAll("contentText", "*", 1, 1000);
Log.Message(Results.MappedName);
}

 

Any ideas? Many thanks

 

 

12 REPLIES 12
Highlighted
Community Hero

Not a problem, @a_g_reed .  Newbies who seek to learn are better than ones who assume they know everything already. 😉

 

Anyways... this is a basic coding task, looping through an array.  While this is test automation, you are, effectively, writing code so it is a good idea to find a coding tutorial somewhere as well.  For JavaScript, I'd recommend https://www.w3schools.com/js/default.asp

 

That said... two things... you say "print the object"... that's not exactly what you're seeking to do.  An object has properties like "Caption" or "wText" or "ContentText" or something like that.  So, you first need to know what you're looking to print.  From there, it's a for loop like what is posted above.  Keep in mind that if the property is blank (like "MappedName" for the OP), then you'll print blank.

 

 


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
Highlighted
Occasional Contributor

Thank you so much,@tristaanogre  - that definitely clears some things up for me. So, in other words, I can use a method such as FindAllChildren configured to return a property such as FullClassName? I guess I'm still a bit confused about the method's operation parameters. Would I leave the PropValues as 'not specified' in order to return all child objects with the aforementioned property?

I'm going to be spending the day reviewing some coding tutorials Robot Happy

Thanks again for your reply and advice.

- Allen

Highlighted
Community Hero

Hi Allen,

 

> I can use a method such as FindAllChildren configured to return a property such as FullClassName?

No.

Refer to the Object Browser window in TestComplete. The tree on the left is a list of processes running in your system. If you expand any process, you will see a list of objects (windows, etc.) that this given process consists from and that are accessible to TestComplete.

If you select any object in the tree (click on it), than the right pane will provide you with the list of properties and their values, as well as with the list of the methods (on the respective tab) that the selected object consisits from.

.FindAllChildren method of TestComplete always returns an array of child objects selected according to the specified criteria (property names and values). And then, you may iterate through the returned array and for each its element (that will be an object from your tested application) you may access its properties and their values.

 

The same, but in slightly different wording: You cannot search for property in TestComplete. Property is an attribute of an object. You can search for object(s) and specify property name and value as a filter condition.

Once the object is found, you may acces (get/set) values of its properties and/or call its methods.

 

For example:

This line of code

var resultsArray = paymentWindow.FindAllChildren(["WndClass", "Visible"],["button", true], 5);

translated into human language will mean this:

"Search the tree of child objects of the paymentWindow up to 5 levels deep and look for the objects that a) have WndClass property and the value of this property is 'button'; and b) have Visible property and the value of this property equals to true and return found objects as items of the resultsArray array."

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Get properties of a web page element

See replies!

Compare images using the Region Checkpoint

See replies!

Compare HTML table with Excel file and correct data in Excel file

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!
Top Kudoed Authors