public void AnalyseSimpleT() { m_Process = Process.Start(@"D:\code\演示程序\RunClient.exe"); m_Application = Application.Attach(m_Process); var window = m_Application.GetWindows()[0]; var element = window.GetElement(SearchCriteria.ByAutomationId("textBox_IP")); var result = BaseWindowFinder.GetBaseCondiction(element, window); Assert.AreEqual(result.Pairs.Count,0); m_Process.Kill(); }
public void AnalyseNoFindT() { m_Process = Process.Start(@"D:\code\演示程序\RunClient.exe"); var notepad= Process.Start("Notepad.exe"); m_Application = Application.Attach(m_Process); var window = m_Application.GetWindows()[0]; var element = Application.Attach(notepad).GetWindows()[0].AutomationElement; var result = BaseWindowFinder.GetBaseCondiction(element, window); Assert.AreEqual(result,null); m_Process.Kill(); notepad.Kill(); }
public void GetAllControlsSimpleTest() { m_Process = Process.Start(@"D:\code\演示程序\RunClient.exe"); m_Application = Application.Attach(m_Process); var window = m_Application.GetWindows()[0]; var element = window.GetElement(SearchCriteria.ByAutomationId("textBox_IP")); CondictionScript baseC = null; var controls = new List<ControlScript>(); ControlsAnalyse.GetControlScript(element, window, out baseC, out controls); Assert.AreEqual(controls[8].CreatCondiction.Pairs[0].Type,CondictionType.AutomationID); Assert.AreEqual(controls[8].CreatCondiction.Pairs[0].Paremter, "SmallIncrement"); m_Process.Kill(); }
private void CleanSqlSnap() { Directory.CreateDirectory(_completedLogPath + @"\SqlSnaps"); var win = _sqlSnaps.GetWindows()[0]; win.Get <Button>(SearchCriteria.ByText("Save")) .Click(); win.Get <TextBox>(SearchCriteria.ByAutomationId("1001").AndByClassName("Edit")) .SetValue(_completedLogPath + @"\SqlSnaps\SQLSnaps.xml"); win.Get <Button>(SearchCriteria.ByClassName("Button").AndByText("Save")) .Click(); win.Close(); }
public void ConvertAnimsToAsc(SortedSet <string> toConvert = null) { KeyboardInput.SpecialKeys specialKey; string[] files = Helper.GetFiles(string.Concat(this.GothicDir, "_WORK\\DATA\\ANIMS\\"), "_COMPILED\\*.*|MDS_MOBSI\\*.*", SearchOption.AllDirectories); TestStack.White.Application application = TestStack.White.Application.Launch(this.GothicSourcerExe); Window window = application.GetWindows().First <Window>(); Helper.ResetWindow(window.Title); string[] strArrays = files; for (int i = 0; i < (int)strArrays.Length; i++) { string str = strArrays[i]; string ext = Path.GetExtension(str).ToUpper(); if (ext == ".MDL") { specialKey = KeyboardInput.SpecialKeys.SHIFT; } else if ((ext == ".MDS") || (ext == ".MSB")) { specialKey = KeyboardInput.SpecialKeys.CONTROL; } else if (ext == ".MMB") { specialKey = KeyboardInput.SpecialKeys.ALT; } else { continue; } if (!File.Exists(string.Concat(new string[] { this.GothicDir, "_WORK\\DATA\\ANIMS\\asc_", Path.GetFileNameWithoutExtension(str).ToLower(), "\\", Path.GetFileNameWithoutExtension(str).ToUpper(), ".ASC" }))) { if (!File.Exists(string.Concat(new string[] { this.GothicDir, "_WORK\\DATA\\ANIMS\\asc_", Path.GetFileNameWithoutExtension(str).ToLower(), "\\", Path.GetFileNameWithoutExtension(str).ToUpper(), ".MDS" })) && !File.Exists(string.Concat(this.GothicDir, "_WORK\\DATA\\ANIMS\\asc_static\\", Path.GetFileNameWithoutExtension(str).ToUpper(), ".ASC"))) { if (toConvert == null || toConvert.Contains(Path.GetFileNameWithoutExtension(str).ToUpper())) { while (application.GetWindows().Count == 1) { window.Keyboard.HoldKey(specialKey); window.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.F8); window.Keyboard.LeaveKey(specialKey); } window.Get <TestStack.White.UIItems.TextBox>(SearchCriteria.ByAutomationId("1047")).Text = str; window.Get <TestStack.White.UIItems.TextBox>(SearchCriteria.ByAutomationId("1048")).Text = string.Concat(this.GothicDir, "_WORK\\DATA\\"); window.Get <TestStack.White.UIItems.ListBoxItems.ComboBox>(SearchCriteria.ByAutomationId("1051")).Select(this.GothicVersion); try { window.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByAutomationId("1")).Click(); } catch { } string text = ""; do { text = window.Get <TestStack.White.UIItems.ListView>(SearchCriteria.ByAutomationId("1001")).Rows.Last <ListViewRow>().Cells.First <ListViewCell>().Text; Thread.Sleep(100); }while (!text.Contains("error(s)") || !text.Contains("warning(s)")); } } } } application.Kill(); }