Ask a Question

How To use "Find" Method with multipe properties and values in connected application (C# Code)

SOLVED
Ivg
Occasional Contributor

How To use "Find" Method with multipe properties and values in connected application (C# Code)

Hi,

 

I am able to pass single property and value, how to pass multiple properties and values to identify the object?

 

C# arrays are not supported

 

Something like this is also not working:

 

var propNames = "text,Enabled";
var propValues = "Simulate,True";

...["Find"](propNames, propValues, 100, false);

 

 

How can I pass array as a parameter?

 

Thanks!

9 REPLIES 9
cunderw
Community Hero

Try something like this.

 

 propNames = new Array ("text","Enabled");

Thanks,
Carson

Click the Accept as Solution button if my answer has helped
Ivg
Occasional Contributor

It's not working, it's not like JScript/C# Script or something like that.

 

'Array' in C# is an abstract class

Ivg
Occasional Contributor

'PropNames' and 'PropValues' should be of 'var' type.

 

When I'm looking at the TestComplete's 'var' type declaration, I can see the supported types 'var' can get in his c'tor.

There aren't any arrays there.

 

Is it impossible to use multiple names & values when writing connected app in C#?

I use multi-part searches in C# Script.

 

var typeARR = Array("VCLClass", "Caption");

var valueARR = Array("class_name", "caption_text");

 

var do_search = panel_object["FindAllChildren"](typeARR, valueARR, 3, true);

 

Works fine for me.

 

Not embedded within a C# application though. Just run as a scripted test within TestComplete. Not sure about it if it's embedded in the application ...

 

 

Hi Colin,

 

Yes, this will work for C#Script from TestComplete, but not for pure C# from the Connected Application. And this is what was requested in the initial thread message.

 

@Ivg, if no solution was found yet, I would recommend to ask Support directly via the http://support.smartbear.com/message/?prod=TestComplete form.

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
================================

Ah right.

 

Wasn't quite sure.

 

In which case, is this:

 

http://community.smartbear.com/t5/Getting-Started-with/FindAllChildren/td-p/94331

 

Any help? It has a reply using FindAllChildren with multiple properties/values in C#. Although, there is no reply to say if it worked or not?

Interesting...

Thank you a lot, Colin, for the link!

Can't check at the moment if the referenced code can be built (at least), so any comment from @Ivg is appreciated.

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
================================
Ivg
Occasional Contributor

Colin, thanks for the link!

It helped.

No problem. Smiley Happy

cancel
Showing results for 
Search instead for 
Did you mean: