Ejemplo n.º 1
0
 //This method Type the value which passed to this method
 public static bool Type(TestStack.White.UIItems.WindowItems.Window window, string elementid, string value)
 {
     try
     {
         TextBox textbox = window.Get <TextBox>(SearchCriteria.ByAutomationId(elementid));
         textbox.Text = value;
         return(true);
     }
     catch (Exception)  {
         try
         {
             TextBox textbox = window.Get <TextBox>(SearchCriteria.ByText(elementid));
             textbox.Text = value;
             return(true);
         }
         catch (Exception)
         {
             try
             {
                 TextBox textbox = window.Get <TextBox>(SearchCriteria.ByClassName(elementid));
                 textbox.Text = value;
                 return(true);
             }
             catch (Exception)
             {
                 Console.WriteLine("Not able to find the element");
                 return(false);
             }
         }
     }
 }
Ejemplo n.º 2
0
        public static void loginPSC(Window loginWindow)
        {
            Input.Type(loginWindow, "txtUsername", "*****@*****.**");
            Input.Type(loginWindow, "txtPassword", "Theranos#123");

            Input.Click(loginWindow, "Login");
        }
Ejemplo n.º 3
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.º 4
0
 public SearchPage(Window window)
 {
     this.searchwindow = window;
     rj             = new ReadJson("searchpage.json");
     standard       = new StandardOperations(window);
     searchpatients = new Dictionary <string, string>();
 }
Ejemplo n.º 5
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.º 6
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var psi = new ProcessStartInfo(System.Windows.Forms.Application.ExecutablePath);
            // launch the process through white application
            _application = TestStack.White.Application.Attach(Process.GetCurrentProcess());
            _mainWindow = _application.GetWindow("MainWindow", InitializeOption.NoCache);

            Point textboxLocation = txtbox.PointToScreen(new Point(0d, 0d));

            Microsoft.Test.Input.Mouse.MoveTo(new System.Drawing.Point((int)textboxLocation.X, (int)textboxLocation.Y));
            Microsoft.Test.Input.Mouse.Click(Microsoft.Test.Input.MouseButton.Left);

            TextCompositionManager.StartComposition(
                new TextComposition(InputManager.Current, txtbox, "pwpito"));

            //var button = _mainWindow.Get<Button>("stopButton");
            //button.Click();


            //TextCompositionManager.StartComposition(
            //    new TextComposition(InputManager.Current, txtbox, " papito"));

            //AutomationElement automationElement = _mainWindow.GetElement(SearchCriteria.ByAutomationId("stopButton"));
            //var invokePattern = automationElement.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern;
            //invokePattern.Invoke();

            //this.stopButton.

            //Keyboard.Type("Hello world.");
            //Keyboard.Press(Key.Shift);
            //Keyboard.Type("hello, capitalized world.");
            //Thread.Sleep(100);
            //SendKeys.SendWait("pepe");
            // Keyboard.Release(Key.Shift);
        }
Ejemplo n.º 7
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.º 8
0
        public void startApp(string iappName)
        {
            try
            {
                //Get the appname
                if (iappName != "")
                {
                    appName = iappName;
                }
                else
                {
                    MessageBox.Show("Incorrect App Name");
                }

                var psi = new ProcessStartInfo(exeSourceFile);

                // launch the process through white application
                _application = TestStack.White.Application.AttachOrLaunch(psi);

                //Get the window of calculator from white application
                _mainWindow = _application.GetWindow(SearchCriteria.ByText(appName), InitializeOption.NoCache);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + " \n Failed to start App. App name may not be set!");
            }
        }
Ejemplo n.º 9
0
 //Read TestBox value
 public static string ReadTextBoxValue(TestStack.White.UIItems.WindowItems.Window window, string elementid)
 {
     try
     {
         TextBox textbox = window.Get <TextBox>(SearchCriteria.ByAutomationId(elementid));
         return(textbox.Text);
     }
     catch (Exception)
     {
         try
         {
             TextBox textbox = window.Get <TextBox>(SearchCriteria.ByText(elementid));
             return(textbox.Text);
         }
         catch (Exception)
         {
             try
             {
                 TextBox textbox = window.Get <TextBox>(SearchCriteria.ByClassName(elementid));
                 return(textbox.Text);
             }
             catch (Exception)
             {
                 Console.WriteLine("Not able to get the text value");
                 return(null);
             }
         }
     }
 }
Ejemplo n.º 10
0
 //Default Constructor
 public AutoApp()
 {
     exeSourceFile = "";
     appName       = "";
     _application  = null;  //This is set by the start method
     _mainWindow   = null;  //This is set by the start method
 }
Ejemplo n.º 11
0
 public static void HandleModelWindow(this wi.WindowItems.Window win, Func <wi.WindowItems.Window, bool> func)
 {
     foreach (var w in win.ModalWindows())
     {
         func(w);
     }
 }
Ejemplo n.º 12
0
 //This method Type the value which passed to this method
 public static bool SelectRadioButton(TestStack.White.UIItems.WindowItems.Window window, string elementid)
 {
     try
     {
         Radio radio = window.Get <Radio>(SearchCriteria.ByAutomationId(elementid));
         radio.Click();
         return(true);
     }
     catch (Exception)
     {
         try
         {
             Radio radio = window.Get <Radio>(SearchCriteria.ByText(elementid));
             radio.Click();
             return(true);
         }
         catch (Exception)
         {
             try
             {
                 Radio radio = window.Get <Radio>(SearchCriteria.ByClassName(elementid));
                 radio.Click();
                 return(true);
             }
             catch (Exception)
             {
                 Console.WriteLine("Not able to find the element");
                 return(false);
             }
         }
     }
 }
Ejemplo n.º 13
0
        public static void Main(string[] args)
        {
            Application launchapp     = Setup.launchPSC();
            Application application   = Setup.attachPSC();
            pscWindow   currentWindow = Setup.getWindow(application);

            Login.loginPSC(currentWindow);
        }
Ejemplo n.º 14
0
 public BasicInfoPage(Window window)
 {
     this.basicinfowindow = window;
     standard             = new StandardOperations(window);
     rj        = new ReadJson("addpatientpage.json");
     basicinfo = new Dictionary <string, string>();
     gpd       = new GetPatientData();
 }
Ejemplo n.º 15
0
 public IIdeaProcessManipulator Attach()
 {
     _mainWindow = Application.Attach("idea64")
                   .Find(title => title.Contains("IntelliJ IDEA"), InitializeOption.WithCache);
     _intPtr         = GetDC(IntPtr.Zero);
     _turnedOffPixel = GetPixel(_intPtr, (int)_extractButtonPosition.X, (int)_extractButtonPosition.Y);
     return(this);
 }
Ejemplo n.º 16
0
 //SampleTest Class Constructor to launch PSC and get the current window of PSC
 // [TestFixtureSetUp]
 public void SetupTest()
 {
     application   = Setup.attachPSC();
     currentWindow = Setup.getWindow(application);
     standard      = new StandardOperations(currentWindow);
     search        = new SearchPage(currentWindow);
     tabs          = new Tabs(currentWindow);
 }
Ejemplo n.º 17
0
 public AdditionalInfoPage(Window window)
 {
     this.additionalinfowindow = window;
     standard       = new StandardOperations(window);
     rj             = new ReadJson("additionalinfopage.json");
     additionalinfo = new Dictionary <string, string>();
     gpd            = new GetPatientData();
 }
Ejemplo n.º 18
0
 public void SetupTest()
 {
     Console.WriteLine("Setting up environment for the Test");
     Setup.launchPSC();
     application   = Setup.attachPSC();
     currentWindow = Setup.getWindow(application);
     //TestRunner runner = new TestRunner();
 }
        public void OpenFlStudio()
        {
            TestStack.White.Application application = TestStack.White.Application.Launch(flStudioPath);
            this.window       = application.GetWindow("FL Studio 20", InitializeOption.NoCache);
            this.windowHandle = application.Process.Handle;
            Logger.Log($"Recived window Handle: {windowHandle}");

            UIItemCollection coll = window.Items;
        }
Ejemplo n.º 20
0
 public TestRunner()
 {
     launchapp     = Setup.launchPSC();
     application   = Setup.attachPSC();
     currentWindow = Setup.getWindow(application);
     search        = new SearchPage(currentWindow);
     standard      = new StandardOperations(currentWindow);
     tabs          = new Tabs(currentWindow);
 }
Ejemplo n.º 21
0
        private void HandleWeightedFieldsSpec(wi.WindowItems.Window win)
        {
            const string title = "Weighted Fields Specification";

            if (win.Title != title)
            {
                throw new ArgumentException("Window title is not " + title);
            }
        }
Ejemplo n.º 22
0
 private static TestStack.White.UIItems.WindowItems.Window GetTeamViewerWindow(Application app)
 {
     TestStack.White.UIItems.WindowItems.Window window = Desktop.Instance.Windows().FirstOrDefault(w => w.Title.ToUpper().Contains("TEAMVIEWER"));
     if (window == null)
     {
         Thread.Sleep(new TimeSpan(0, 0, 5));
         return(GetTeamViewerWindow(app));
     }
     return(window);
 }
Ejemplo n.º 23
0
        public void TestUIBasic()
        {
            // Test d'interfície gràfica
            string rutaAlExecutable = System.AppDomain.CurrentDomain.BaseDirectory;

            rutaAlExecutable += "\\RRHHApp.exe";
            Application app = Application.Launch(rutaAlExecutable);

            TestStack.White.UIItems.WindowItems.Window w = app.GetWindows()[0];
            //------------------------------------------
            ComboBox cboOperacio = w.Get <ComboBox>("cboOperacio");
            Button   b           = w.Get <Button>("btnOperar");
            TextBox  tr          = w.Get <TextBox>("txtRes");
            //------------------------------------------
            TextBox t1 = w.Get <TextBox>("txtOp1");
            TextBox t2 = w.Get <TextBox>("txtOp2");
            int     num1 = 2, num2 = 3;

            t1.Text = "" + num1;
            t2.Text = "" + num2;
            //--------------------------------------------
            // Operació "+"
            //--------------------------------------------
            cboOperacio.Select("+");
            b.Click();
            Assert.AreEqual(num1 + num2 + "", tr.Text);
            //--------------------------------------------
            //--------------------------------------------
            // Operació "-"
            //--------------------------------------------
            cboOperacio.Select("-");
            b.Click();
            Assert.AreEqual(num1 - num2 + "", tr.Text);
            //--------------------------------------------
            //--------------------------------------------
            // Operació "*"
            //--------------------------------------------
            cboOperacio.Select("*");
            b.Click();
            Assert.AreEqual(num1 * num2 + "", tr.Text);
            //--------------------------------------------
            //--------------------------------------------
            // Operació "/"
            //--------------------------------------------
            cboOperacio.Select("/");
            b.Click();
            Assert.AreEqual(num1 / num2 + "", tr.Text);
            //--------------------------------------------

            ListView dtgPersones = w.Get <ListView>("dtgPersones");

            dtgPersones.Rows[1].Cells[0].Click();
            Assert.AreEqual("Maria", dtgPersones.SelectedRows[0].Cells[1].Text);
        }
Ejemplo n.º 24
0
        public static bool openPianoRollContextMenuFile(IntPtr windowHandle, TestStack.White.UIItems.WindowItems.Window window)
        {
            bool res = false;

            //TODO: FIX THIS
            //  if (isPianoRollContextSubMenuOpen(windowHandle, window))
            // {
            SendKeys.SendWait("f"); //->File
            res = true;
            // }
            return(res);
        }
Ejemplo n.º 25
0
        protected void btnOpenWndw_Click(object sender, EventArgs e)
        {
            try
            {
                KillRDPSession();
                TimeBoundAccessRequest tbar = Session["TBAR"] as TimeBoundAccessRequest;
                CoreAppXmlConfiguration.Instance.BusyTimeout = 20000;
                Application app = TestStack.White.Application.Launch(@"E:\Software\TeamViewer_Setup.exe");

                TestStack.White.UIItems.WindowItems.Window tvWindow        = GetTeamViewerWindow(app);
                TestStack.White.UIItems.RadioButton        runOnceCheckBox = tvWindow?.Items.FirstOrDefault(w => w.Name.ToUpper().Contains("ONE TIME")) as TestStack.White.UIItems.RadioButton;
                runOnceCheckBox.Select();
                TestStack.White.UIItems.Button button = tvWindow?.Items.FirstOrDefault(w => w.Name.ToUpper().Contains("ACCEPT")) as TestStack.White.UIItems.Button;
                button.Click();
                tvWindow = GetTeamViewerWindow(app);

                //give tv some seconds to intialize
                Thread.Sleep(new TimeSpan(0, 0, 10));

                //Takes a screenshot of the entire desktop, and saves it to disk
                tvWindow.Focus(TestStack.White.UIItems.WindowItems.DisplayState.Maximized);
                Bitmap bitmap        = Desktop.CaptureScreenshot();
                string ImageName     = DateTime.Now.Ticks.ToString() + ".jpg";
                String saveImagePath = Server.MapPath("Images/") + ImageName;
                bitmap.Save(saveImagePath);
                tvImageDesktop.ImageUrl = "Images/" + ImageName;
                Session["APP"]          = app;

                imgDiv.Visible        = true;
                processingDiv.Visible = false;
                btnOpenWndw.Text      = "RE-START THIS SESSION";

                Task.Factory.StartNew(() =>
                {
                    DateTime maxDate     = tbar.StartTime.AddMinutes(tbar.DurationInMinutes);
                    DateTime currentDate = DateTime.Now;
                    int minutesLeft      = ((int)maxDate.Subtract(currentDate).TotalMinutes) + 1;//add an extra minute for network latency
                    Thread.Sleep(new TimeSpan(0, minutesLeft + AnyAdditionalMinutes, 0));
                    KillRDPSession();
                    //string msg = "SESSION HAS EXPIRED";
                    //Master.ErrorMessage = msg;
                    return;
                });
            }
            catch (Exception ex)
            {
                //Show Error Message
                string msg = "ERROR:" + ex.Message;
                Master.ErrorMessage = msg;
                return;
            }
        }
Ejemplo n.º 26
0
        private void HandlePenetrationCorrectionOptions(wi.WindowItems.Window win, PenetrationCorrectionOptions op = PenetrationCorrectionOptions.None)
        {
            const string title = "Penetration Correction Options";

            if (win.Title != title)
            {
                throw new ArgumentException("Window title is not " + title);
            }
            if (op != PenetrationCorrectionOptions.None)
            {
                win.Get <wi.ListBoxItems.ListBox>(wi.Finders.SearchCriteria.ByControlType(ControlType.List)).Select((int)op);
            }
        }
Ejemplo n.º 27
0
        public void SetupTest()
        {
            application   = Setup.attachPSC();
            currentWindow = Setup.getWindow(application);
            standard      = new StandardOperations(currentWindow);
            search        = new SearchPage(currentWindow);
            tabs          = new Tabs(currentWindow);
            bip           = new BasicInfoPage(currentWindow);
            aip           = new AdditionalInfoPage(currentWindow);

            //Searching for the patient
            search.SearchPatient(searchpatient);
            search.SelectFirstSearchRecord();
        }
Ejemplo n.º 28
0
        public bool AddToDo()
        {
            TestStack.White.UIItems.WindowItems.Window todoWindow = null;
            qbApp = QuickBooks.GetApp("QuickBooks");
            qbWindow = QuickBooks.GetAppWindow(qbApp, "Vincent");
            remWindow = Actions.GetWindow(qbWindow, "Reminders");
            silkRemWindow = _desktop.Window("@caption='Reminders'");
            silkRemWindow.Maximize();
            Actions.ClickElementByAutomationID(remWindow, "120");
            todoWindow = Actions.GetChildWindow(qbWindow, "Add To Do");
            Actions.SelectComboBoxItemByText(todoWindow, "cbType", "Appointment");
            Actions.SelectComboBoxItemByText(todoWindow, "cbPriority", "High");
            Actions.SetTextOnElementByAutomationID(todoWindow, "todoDetails", "Pay vendors");
            Actions.ClickElementByName(todoWindow, "OK");

            return true;
        }
Ejemplo n.º 29
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.º 30
0
        public static bool isPianoRollContextSubMenuOpen(IntPtr windowHandle, TestStack.White.UIItems.WindowItems.Window window)
        {
            bool focus   = SetForegroundWindow(windowHandle);
            int  counter = 0;

            foreach (var item in window.Items)
            {
                AutomationElement automationElement = item.AutomationElement;
                if (automationElement.Current.ClassName.Equals("TQuickPopupMenuWindow"))
                {
                    counter++;
                    if (counter == 2)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 31
0
        //If it's allready open -> returns true. If it's closed it tries opens it.
        public static void openPianoRollContextMenu(IntPtr windowHandle, TestStack.White.UIItems.WindowItems.Window window)
        {
            TestStack.White.UIItems.Panel itemToClick = null;

            //TODO: use isPianoRollContextMenuOpen?
            //if (!isPianoRollContextMenuOpen(windowHandle, window))
            //{
            UIItemCollection coll = window.Items;

            foreach (UIItem item in coll)
            {
                if (item.Name.Contains("Piano roll"))
                {
                    if (((TestStack.White.UIItems.Panel)item).Items.Count == 0)
                    {
                        itemToClick = (TestStack.White.UIItems.Panel)item;
                        break;
                    }
                }
            }
            //TODO: Focus alway returns false
            bool focus = SetForegroundWindow(windowHandle);

            if (focus)
            {
                var   mouse = window.Mouse;
                Point p     = itemToClick.Location;
                p.Offset(11, 12);
                mouse.Click(p);
            }
            else
            {
                //Do it as well, but log it
                Debug.Print("Failed to focus window");
                var   mouse = window.Mouse;
                Point p     = itemToClick.Location;
                p.Offset(11, 12);
                mouse.Click(p);
            }
            //}
        }
Ejemplo n.º 32
0
 //This method select perticular button on the page
 public static bool Click(pscWindow window, string elementid)
 {
     try
     {
         Console.WriteLine("Trying to access the element using automation id");
         try
         {
             Button button = window.Get <Button>(SearchCriteria.ByAutomationId(elementid));
             button.Click();
             return(true);
         }
         catch (Exception)
         {
             try
             {
                 Console.WriteLine("Trying to access the element using Name of element");
                 Button button = window.Get <Button>(SearchCriteria.ByText(elementid));
                 button.Click();
                 return(true);
             }
             catch (Exception)
             {
                 try
                 {
                     Console.WriteLine("Trying to access the element using ClassName id");
                     Button button = window.Get <Button>(SearchCriteria.ByClassName(elementid));
                     button.Click();
                     return(true);
                 }
                 catch (Exception)
                 { Console.WriteLine("Not able to find out the element id");
                   return(false); }
             }
         }
     }
     catch (Exception)
     { Console.WriteLine("Not able to click on button");
       return(false); }
 }
Ejemplo n.º 33
0
 public static void Initialize()
 {
     qbApp = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.Initialize(exe);
     qbWindow = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.PrepareBaseState(qbApp);
     InitQB();
     if (!qbWindow.Title.Contains("COSMETICS"))
     {
         FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.OpenOrUpgradeCompanyFile(DefaultCompanyFilePath, qbApp, qbWindow, false, false);
     }
     qbWindow.Focus();
     Reports.ResetQBPrefForCommentedReports(qbApp, qbWindow);
 }
Ejemplo n.º 34
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);
            }
        }