I have the following problem.
I've got a dictionary, where the keys corresponds to labels in my UI, and the values correspond to the value I must set in each control associated with that label.
The problem is that I don't know at compile time what type will the component have (it can be a textbox, combo, list, etc)
Each component shares the parent with the label, so that's the way I'm locating it.
But after that, I want to be able to create adapters (or elements) for each component, and be able, at runtime, to determine the type and using that, change the value in the appropriate way.
Is there any method that given an adapter or element can determine its type, or its capabilities??
Dynamic identification of component types
Re: Dynamic identification of component types
Hey - i'm not sure if this is what you need, but with this method you get the correct adapter for the component if you have its RxPath:
Greetings,
Patrik
Code: Select all
public Adapter findObject(string path, int timeout) {
Element element = Host.Local.FindSingle(path, timeout);
RxPath rxPath= new RxPath(path);
string capabilityName= rxPath.GetCapabilityForTailNodeTest().Name;
System.Type adapterType = Ranorex.Core.ElementEngine.Instance.AdapterTypes[capabilityName];
return Adapter.Create(adapterType, element);
}
Patrik