public void Native_GetElementThroughProperty_Works() { AutomationElementRetievingPattern.Initialize(); var p = (IAutomationElementRetievingPattern)_nTestControlElement.GetCurrentPattern(AutomationElementRetievingPattern.Pattern.Id); var nElementFromProperty = p.CurrentNativeElement; Assert.IsTrue(_nFactory.CompareElements(_nTestControlElement, nElementFromProperty) != 0); }
public void TestElementSupport() { var schema = TestSchema.GetInstance(); // Ask for the custom pattern var testPattern = (ITestPattern)_customElement.GetCurrentPattern(schema.PatternId); Assert.IsNotNull(testPattern); // Call through a pattern getter // We expect to get the custom element var testPropertyValue = testPattern.CurrentElementValue; var compareResult = _factory.CompareElements(_customElement, testPropertyValue); Assert.AreNotEqual(0, compareResult); // Call for the custom property directly // We cannot request the property directly, // since it is declared as a method, not a property. //Interop.UIAutomationClient.IUIAutomationElement testPropertyValue2 = (Interop.UIAutomationClient.IUIAutomationElement)this.customElement.GetCurrentPropertyValue(schema.ElementValueProperty.PropertyId); }