public void Login(string LoginValue, string PasswordValue) { string LoginField = "agentName"; string PasswordField = "password"; string OkButton = "okButton"; Actions.SetValue(LoginField, LoginValue); Actions.SetValue(PasswordField, PasswordValue); Actions.Click(OkButton); if (LoginValue != "john" || PasswordValue != "hp") { var error = ControlFinder.FindByClassName("#32770"); Assert.IsTrue(error.Current.IsEnabled); string failed = error.Current.Name; Assert.AreEqual("Login Failed", failed); } else { Thread.Sleep(1000); var johnsmith = ControlFinder.FindByAutomationId("usernameTitle"); Assert.AreEqual("John Smith", johnsmith.Current.Name); } Thread.Sleep(2000); }
public static void SelectSearchOrderTab() { var mainwindow = ControlFinder.FindByClassName("NavigationWindow"); var tabs = mainwindow.FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.TabItem)); var search_order = tabs.Cast <AutomationElement>().ToList().First(tab => tab.Current.Name.Equals("SEARCH ORDER")); SpecialActions.SelectElementItem(search_order); }