diff --git a/UIAComWrapperTests/AutomationElementTest.cs b/UIAComWrapperTests/AutomationElementTest.cs index 020c80c..fb3f237 100644 --- a/UIAComWrapperTests/AutomationElementTest.cs +++ b/UIAComWrapperTests/AutomationElementTest.cs @@ -109,9 +109,21 @@ public void RootElementTest() [TestMethod()] public void FocusedElementTest() { - AutomationElement actual = AutomationElement.FocusedElement; - Assert.IsNotNull(actual); - Assert.IsTrue(actual.Current.HasKeyboardFocus); + var actuals = + AutomationElement.RootElement.FindAll( + TreeScope.Children, + new PropertyCondition(AutomationElement.IsKeyboardFocusableProperty, true)); + + foreach (AutomationElement actual in actuals) + { + Assert.IsNotNull(actual); + actual.SetFocus(); + + Assert.IsTrue(actual.Current.IsKeyboardFocusable); + if (actual.Current.HasKeyboardFocus) return; + } + + Assert.Fail(); } /// <summary>