Ejemplo n.º 1
0
 public bool SelectSearchRecord()
 {
     try
     {
         Thread.Sleep(3000);
         TestStack.White.UIItems.IUIItem[] item = searchwindow.GetMultiple(SearchCriteria.ByClassName("ListBox"));
         Thread.Sleep(5000);
         return(true);
     }
     catch (Exception)
     {
         Console.WriteLine("Not able to find this record");
         return(false);
     }
 }
Ejemplo n.º 2
0
 //This method select when multiple Button Found for same AutomationID/Name/Class
 public static bool ClickOnSpecificItemByName(pscWindow window, string id)
 {
     try
     {
         TestStack.White.UIItems.IUIItem[] item = window.GetMultiple(SearchCriteria.ByText(id));
         int iter = 0;
         while (iter <= item.Length)
         {
             try
             {
                 item[iter].Click();
                 return(true);
             }
             catch
             {
                 iter++;
                 continue;
             }
         }
         return(false);
     }
     catch (Exception)
     {
         Console.WriteLine("Not able to find item");
         return(false);
     }
 }
Ejemplo n.º 3
0
Archivo: Form1.cs Proyecto: amw786/ASAR
        private void btnAudacity_Click(object sender, EventArgs e)
        {
            if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Audacity\\Audacity.exe"))
            {
                MessageBox.Show("Audacity is not installed...");
                return;
            }
            try
            {
                System.Diagnostics.ProcessStartInfo audacityProcess = new System.Diagnostics.ProcessStartInfo(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Audacity\\Audacity.exe");
                appAudacity = TestStack.White.Application.AttachOrLaunch(audacityProcess);

                audacityWindow           = appAudacity.GetWindow("Audacity", TestStack.White.Factory.InitializeOption.NoCache);
                audacityToolDock         = (TestStack.White.UIItems.Panel)audacityWindow.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("ToolDock"))[0];
                audacityTransportToolbar = (TestStack.White.UIItems.Panel)audacityToolDock.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Audacity Transport ToolBar"))[0];

                AudacityButton_Record      = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Record"))[0];
                AudacityButton_Pause       = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Pause"))[0];
                AudacityButton_Play        = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Play"))[0];
                AudacityButton_Stop        = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Stop"))[0];
                AudacityButton_SkipToStart = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Skip to Start"))[0];
                AudacityButton_SkipToEnd   = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Skip to End"))[0];

                this.TopMost = true;
                this.TopMost = false;
                this.Activate();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Window Unavailable\n" + ex.Message);
            }
        }
Ejemplo n.º 4
0
 //This method select when multiple Button Found for same AutomationID/Name/Class
 public static bool ClickOnSpecificItemByName(pscWindow window, string id)
 {
     try
     {
         TestStack.White.UIItems.IUIItem[] item = window.GetMultiple(SearchCriteria.ByText(id));
         int iter = 0;
         while (iter <= item.Length)
         {
             try
             {
                 item[iter].Click();
                 return(true);
             }
             catch
             {
                 iter++;
                 continue;
             }
         }
         return(false);
     }
     catch (Exception)
     {
         Console.WriteLine("Click action can't be perform for this id -- " + id + " -- as this item not found in current window");
         return(false);
     }
 }
Ejemplo n.º 5
0
        public void TestMethod1()
        {
            Logger test = new Logger("UnitTest");
            bool res = false;
            qbApp = QuickBooks.GetApp("QuickBooks");
            qbWindow = QuickBooks.GetAppWindow(qbApp, "Vincent");
            Actions.SelectMenu(qbApp, qbWindow, "Company", "Reminders");
            remWindow = Actions.GetWindow(qbWindow, "Reminders");

            //Add a todo note
            //res=AddToDo();
            //Assert.AreEqual(true, res, "To Do creation failed");


            silkRemWindow = _desktop.Window("@caption='Reminders'");
            silkRemWindow.Maximize();
           
            var list = silkRemWindow.GetChildren();

            //string a ="TO DO NOTES ( 1 )";
            //string count = a.Split(new char[] { '(', ')' })[1].Trim(); ;

            var textBoxes = remWindow.GetMultiple(SearchCriteria.ByControlType(System.Windows.Automation.ControlType.Edit));
            var panels = remWindow.GetMultiple(SearchCriteria.ByControlType(System.Windows.Automation.ControlType.Pane));
            var customUIItems = remWindow.GetMultiple(SearchCriteria.ByControlType(System.Windows.Automation.ControlType.Custom));
            var groupBoxes = remWindow.GetMultiple(SearchCriteria.ByControlType(System.Windows.Automation.ControlType.Group));
            var buttons = remWindow.GetMultiple(SearchCriteria.ByControlType(System.Windows.Automation.ControlType.Button));
            var thumbs = remWindow.GetMultiple(SearchCriteria.ByControlType(System.Windows.Automation.ControlType.Thumb));
            var wpfLabels = remWindow.GetMultiple(SearchCriteria.ByControlType(System.Windows.Automation.ControlType.Text));

            //foreach (TestStack.White.UIItems.GroupBox g in groupBoxes)
            //{
            //    //var gChild = 

            //}
            foreach (TestStack.White.UIItems.Button b in buttons)
            {
                if(b.Name.Contains("TO DO"))
                    Actions.ClickButtonByAutomationID(remWindow, "ExpanderButton");
            }
            list = silkRemWindow.GetChildren();
            var a = remWindow.GetMultiple(SearchCriteria.All);

        }
Ejemplo n.º 6
0
        private void btnAudacity_Click(object sender, EventArgs e)
        {
            if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Audacity\\Audacity.exe"))
            {
                MessageBox.Show("Audacity is not installed...");
                return;
            }
            try
            {
                System.Diagnostics.ProcessStartInfo audacityProcess = new System.Diagnostics.ProcessStartInfo(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Audacity\\Audacity.exe");
                appAudacity = TestStack.White.Application.AttachOrLaunch(audacityProcess);

                audacityWindow = appAudacity.GetWindow("Audacity", TestStack.White.Factory.InitializeOption.NoCache);
                audacityToolDock = (TestStack.White.UIItems.Panel)audacityWindow.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("ToolDock"))[0];
                audacityTransportToolbar = (TestStack.White.UIItems.Panel)audacityToolDock.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Audacity Transport ToolBar"))[0];

                AudacityButton_Record = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Record"))[0];
                AudacityButton_Pause = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Pause"))[0];
                AudacityButton_Play = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Play"))[0];
                AudacityButton_Stop = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Stop"))[0];
                AudacityButton_SkipToStart = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Skip to Start"))[0];
                AudacityButton_SkipToEnd = (TestStack.White.UIItems.Button)audacityTransportToolbar.GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByText("Skip to End"))[0];

                this.TopMost = true;
                this.TopMost = false;
                this.Activate();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Window Unavailable\n"+ex.Message);
            }
        }