11 years ago
Obtaining AutomationId from WPF applications
Hi,
I am testing a WPF application, and I am unable to use the AutomationId to control anything. This has been discussed before here:
http://smartbear.com/forums/f81/fp11/t73357/using-automation-id-to-identify-objects
But the solution given does not appear to be working for me. The original solution is:
I have updated this to:
Sub get_id_test()
Dim SV, AutomationIdProperty
Set SV = Sys.Process("myApp")
Set AutomationIdProperty = AppDomain("SV").dotNET.System_Windows_Automation.AutomationProperties.AutomationIdProperty
AutomationID = WPFObject.GetValue(AutomationIdProperty)
Log.Message(AutomationID)
End Sub
But it fails with: Type mismatch: 'AppDomain'
Can anyone provide assistance on this? Is there an easier way to do this in TC9.2? The first solution was posted nearly 3 years ago, I would have thought a solution would exist without writing a script...
I am testing a WPF application, and I am unable to use the AutomationId to control anything. This has been discussed before here:
http://smartbear.com/forums/f81/fp11/t73357/using-automation-id-to-identify-objects
But the solution given does not appear to be working for me. The original solution is:
Set
AutomationIdProperty = p.AppDomain
"Automation_ID_Sample.exe"
).dotNET.System_Windows_Automation.AutomationProperties.AutomationIdProperty
AutomationID = MyObject.GetValue(AutomationIdProperty)
Log.Message(AutomationID)
I have updated this to:
Sub get_id_test()
Dim SV, AutomationIdProperty
Set SV = Sys.Process("myApp")
Set AutomationIdProperty = AppDomain("SV").dotNET.System_Windows_Automation.AutomationProperties.AutomationIdProperty
AutomationID = WPFObject.GetValue(AutomationIdProperty)
Log.Message(AutomationID)
End Sub
But it fails with: Type mismatch: 'AppDomain'
Can anyone provide assistance on this? Is there an easier way to do this in TC9.2? The first solution was posted nearly 3 years ago, I would have thought a solution would exist without writing a script...