public ITextBox FindTextBox(string accessibleName) { if (Session == null) { throw new Exception($"Please call method {nameof(Initialize)}, first"); } return(TextBoxServices.Create(Session.FindElementByAccessibilityId(accessibleName))); }
public bool EnterFileNameAndPressEnter(string fileName, string windowName, List <string> log) { if (!TestProcessHelper.IsProcessRunning(TestProcessHelper.ProcessType.Paleface)) { log.Add("Paleface clipboard helper window has not been started"); return(false); } var windowsChildElementSearchSpec = WindowsElementSearchSpec.Create("#32770", string.IsNullOrWhiteSpace(windowName) ? "Open" : ""); var windowsGrandChildElementSearchSpec = WindowsElementSearchSpec.Create(UiClassNames.Edit, "File name:"); windowsChildElementSearchSpec.WindowsChildElementSearchSpecs.Add(windowsGrandChildElementSearchSpec); var windowsElementSearchSpec = string.IsNullOrWhiteSpace(windowName) ? WindowsElementSearchSpec.Create("", "Desktop 1") : WindowsElementSearchSpec.Create(UiClassNames.Window, windowName); windowsElementSearchSpec.WindowsChildElementSearchSpecs.Add(windowsChildElementSearchSpec); var element = WindowsElementSearcher.SearchWindowsElement(windowsElementSearchSpec, log); if (element == null) { return(false); } element.SendKeys(""); element = WindowsElementSearcher.SearchWindowsElement(element, windowsGrandChildElementSearchSpec, log); if (element == null) { return(false); } element.SendKeys(""); var textBox = TextBoxServices.Create(element); textBox.Clear(); textBox.Text = fileName; if (textBox.Text != fileName) { return(false); } element.SendKeys(Keys.Enter); return(true); }