cancel
Showing results for 
Search instead for 
Did you mean: 

FindAll method

SOLVED
Highlighted
Occasional Contributor

FindAll method

I'm using TestLeft and I'd like to find all the children of a particular object which match a pattern. I can't see a way of doing this, if I use Find<> it only returns one object and if I just use object.Children, I can't filter it with a pattern.

Is there a way to do this?

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator

Re: FindAll method

Hi all,

 

FindAll is now available in TestLeft 2.0.


Helen Kosova
SmartBear Technical Writer
________________________

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓

View solution in original post

4 REPLIES 4
Contributor

Re: FindAll method

Hello wilkinc,

 

It seems that Testleft does not support this method yet but since you've found the container of the child objects that you are looking for, you could implement something like this.

 

suppose you have your containter called myContainer.

 

Class_of_the_child myChildObject = null;

 

do{

  try{

    myChildObject = myContainer.Find<Class_of_the_child >(new YOUR_TECHNOLOGY_PATTERN()

   {

      my_search_criteria1 = search_criteria_param1,

      my_search_criteria2 = search_criteria_param2

    },50);

  }catch{

  //Do whatever error handling you wish. There is no need, the Find method returns null the the object is not found.

  }

  //Do whatever you want with the child. You may put them all into an array if you wish

while (myChildObject != null)

 

Best regards,

 

Leandro de Araújo Souza

Community Hero

Re: FindAll method

Hi,

 

In addition to the previous reply, I would suggest to ask for this functionality: https://community.smartbear.com/t5/TestLeft-Feature-Requests/idb-p/TestLeftFeatureRequests

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
New Contributor

Re: FindAll method

As a workaround CallMethod of IObject class might be used. Here is an example:

 

        internal List<ICheckBox> MenuItems
        { get { return NavigationTargetsContainer.CallMethod<IEnumerable<object>>("FindAll", "ClrFullClassName", "System.Windows.Controls.CheckBox", 5)
                                                                                    .Select(obj => ((IObject)obj).Cast<ICheckBox>()).ToList(); } }

  But I totally agree, the special signature of FindAll method is absolutely necessary.

Moderator

Re: FindAll method

Hi all,

 

FindAll is now available in TestLeft 2.0.


Helen Kosova
SmartBear Technical Writer
________________________

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓

View solution in original post