I want to create an object using reflection class PropertyCondition(in assembly UIAutomationClient.dll).In order to obtain the desired class constructor , I use the following code:
var assembly = AppDomain.CurrentDomain.GetAssemblies().First(x => x.FullName.Contains("AutomationClient"));
var propertyConditionType = assembly.DefinedTypes.First(x => x.Name == "PropertyCondition");
var automationElementType = assembly.DefinedTypes.First(x => x.Name == "AutomationElement");
var automationIdPropertyType = automationElementType.GetField("AutomationIdProperty").FieldType;
var constructor = propertyConditionType.GetConstructor(new Type[] { automationIdPropertyType, typeof(object) });
But how do I pass in constructor AutomationElement.AutomationIdProperty ?
Thank you.
Aucun commentaire:
Enregistrer un commentaire