コード例 #1
0
        static void Main(string[] args)
        {
            Process proc = Process.GetProcessesByName("QBW32").FirstOrDefault();

            TestStack.White.Application app = TestStack.White.Application.Attach(proc);

            SearchCriteria sc = SearchCriteria.ByClassName("MauiFrame");

            var mainWindow = app.GetWindow(sc, InitializeOption.WithCache);

            mainWindow.Focus();

            SendKeys.SendWait("%+{y}{P}{U}");

            Thread.Sleep(3000);

            var modelWindows = mainWindow.ModalWindows()
                               .Where(w => w.Title == "Enter Payroll Information")
                               .FirstOrDefault();

            //var table = GetTableElement(modelWindows);

            //AutomationElement elm = modelWindows
            //    .GetElement(SearchCriteria.ByControlType(ControlType.HeaderItem));

            //SearchCriteria tableSearch = SearchCriteria.ByControlType(ControlType.HeaderItem);


            //var table = modelWindows.Get<TestStack.White.UIItems.TableItems.TableHeader>(tableSearch);

            var x = 0;
        }
コード例 #2
0
ファイル: Input.cs プロジェクト: skapil/pscwhite
 //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);
             }
         }
     }
 }
コード例 #3
0
ファイル: Input.cs プロジェクト: skapil/pscwhite
 //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);
             }
         }
     }
 }
コード例 #4
0
ファイル: Input.cs プロジェクト: qatesting/pscautomation
 //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);
             }
         }
     }
 }
コード例 #5
0
ファイル: App.cs プロジェクト: TemaKh/PaintTesting
 private App()
 {
     application = Application.Launch(Configuration.ApplicationExePath);
     Window      = application.GetWindow(SearchCriteria.ByClassName(Configuration.ClassName), InitializeOption.NoCache);
     WindowName  = Window.Name;
     LoggerUtil.Info($"Application is open");
 }
コード例 #6
0
        public void TetsNotepadPastASCII()
        {
            Assert.IsNotNull(application);
            TextBox tb = GetWindow().Get <TextBox>(SearchCriteria.ByClassName("Edit"));

            tb.Text = GenerateASCIIString();
        }
コード例 #7
0
ファイル: Customer.cs プロジェクト: rsdivahar/teststack-white
        public bool AddNewCustomer()
        {
            Boolean bResults = false;

            try
            {
                this.OpenCustomerWindow();

                ClickOnButton(wCustomerWin, ButtonConstants.BTN_ADD_CUST);
                LoggerUtility.WriteLog("Clicked the Add");

                Window wCustomerAddWin = GetChildWindowByID(wCustomerWin, AppConstants.WIN_CUSTOMER_ADD);
                wCustomerAddWin.WaitWhileBusy();

                PropertyGrid FirstNamePlaceHolder = wCustomerAddWin.Get <PropertyGrid>(SearchCriteria.ByAutomationId("C_CUSTOMERFIELD_1"));
                LoggerUtility.WriteLog("Got the wCustomerAddWin Control, going to Perform Entry");
                TextBox txtAddCust = FirstNamePlaceHolder.Get <TextBox>(SearchCriteria.ByClassName("WindowsForms10.RichEdit20W.app.0.1a8c1fa_r14_ad1"));
                txtAddCust.Focus();
                txtAddCust.Text = "Sahaya";

                LoggerUtility.WriteLog("Jerish Name Entered");
                Thread.Sleep(10000);
                return(true);
            }
            catch
            {
                LoggerUtility.WriteLog("Failure Message: Failed to Select the Customer");
                return(bResults);

                throw;
            }
        }
コード例 #8
0
 public InteractiveWindowWrapper(Window mainWindow)
 {
     MainWindow = mainWindow;
     Assert.NotNull(MainWindow);
     ContentPanel = MainWindow.Get <Panel>(SearchCriteria.ByClassName("ScrollViewer"));
     Assert.NotNull(ContentPanel);
 }
コード例 #9
0
ファイル: Input.cs プロジェクト: skapil/pscwhite
 //This method select when multiple Button Found for same AutomationID/Name/Class
 public static bool ClickOnSpecificItemByClass(pscWindow window, string id)
 {
     try
     {
         TestStack.White.UIItems.IUIItem[] item = window.GetMultiple(SearchCriteria.ByClassName(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);
     }
 }
コード例 #10
0
ファイル: LoginModel.cs プロジェクト: ZeroTull/EC4
 public LoginModel(Window loginWindow)
 {
     loginTextBox       = loginWindow.Get <TextBox>(SearchCriteria.ByAutomationId(LoginWindowIDs.LOGINTEXTBOX));
     passwordField      = loginWindow.Get <TextBox>(SearchCriteria.ByAutomationId(LoginWindowIDs.PASSWORDTEXTBOX));
     clientField        = loginWindow.Get <TextBox>(SearchCriteria.ByAutomationId(LoginWindowIDs.CLIENDTEXTBOX));
     rememberMeCheckBox = loginWindow.Get <CheckBox>(SearchCriteria.ByClassName(LoginWindowIDs.REMEMBERMECHECKBOX));
     loginButton        = loginButton = loginWindow.Get <Button>(SearchCriteria.ByAutomationId(LoginWindowIDs.LOGINBUTTON));
 }
コード例 #11
0
        IUIItem GetCell(int rowIndex,
                        int columnIndex)
        {
            var row = GetRowFromIndex(rowIndex);

            return(row.Get(SearchCriteria.ByClassName(typeof(DataGridCell).Name)
                           .AndIndex(columnIndex)));
        }
コード例 #12
0
        public void ActivateEndpointExplorer()
        {
            var endpointExplorer = BarManager().Get <GroupBox>(SearchCriteria.ByClassName("LayoutPanel").AndAutomationId("EndpointExplorer"));

            endpointExplorer.ShouldNotBe(null);

            Dock(endpointExplorer);
        }
コード例 #13
0
ファイル: EC4_Login_Logout.cs プロジェクト: ZeroTull/EC4
 public void GivenIHaveSelectedRememberMeCheckbox()
 {
     rememberMeCheckBox = loginWindow.Get <CheckBox>(SearchCriteria.ByClassName("CheckBox"));
     if (!rememberMeCheckBox.Checked)
     {
         rememberMeCheckBox.Click();
     }
 }
コード例 #14
0
        public void ThenThereIsAButtonInColumnOnRow(string buttonText,
                                                    int rowIndex)
        {
            var row    = GetRowFromIndex(rowIndex);
            var button = row.Get <Button>(SearchCriteria.ByClassName(typeof(Button).Name)
                                          .AndByText(buttonText));

            Context.Button = button;
        }
コード例 #15
0
        public void ActivateQueueExplorer()
        {
            var queueExplorer = _barManager.Get <GroupBox>(SearchCriteria.ByClassName("LayoutPanel").AndAutomationId("QueueExplorer"));
            var computerNode  = (TreeNode)queueExplorer.Get(SearchCriteria.ByText("hadi-pc"));

            computerNode.Focus();
            computerNode.CollapseNode();
            computerNode.ExpandNode();
        }
コード例 #16
0
        public bool OpenApplication(string path)
        {
            buttons = new Dictionary <char, string>
            {
                { '0', "124" },
                { '1', "125" },
                { '2', "126" },
                { '3', "127" },
                { '4', "128" },
                { '5', "129" },
                { '6', "130" },
                { '7', "131" },
                { '8', "132" },
                { '9', "133" },
                { '.', "85" },
                { ',', "85" },
                { '/', "90" },
                { 'x', "91" },
                { 'X', "91" },
                { '-', "93" },
                { '+', "92" },
                { '=', "112" },
            };

            try
            {
                if (string.IsNullOrEmpty(path))
                {
                    throw new Exception("É necessário informar o caminho do aplicativo!");
                }

                else if (!File.Exists(path))
                {
                    throw new Exception("Não foi possível localizar o arquivo informado!");
                }

                application = Application.Launch(path);
                application.WaitWhileBusy();

Retorno:
                Thread.Sleep(1000);

                window = application.GetWindow(SearchCriteria.ByClassName("SciCalc"), InitializeOption.NoCache);

                if (window == null)
                {
                    goto Retorno;
                }
            }
            catch (Exception ex)
            {
                OnError?.Invoke(ex);
            }

            return(true);
        }
コード例 #17
0
        IUIItem GetCellOnCurrentlySelectedRow(int cellIndex)
        {
            var row = Context
                      .Grid
                      .SelectedRows
                      .First();

            return(row.Get(SearchCriteria.ByClassName(typeof(DataGridCell).Name)
                           .AndIndex(cellIndex)));
        }
コード例 #18
0
        public void SetTextByClassName(Window wVStoreWin, string sClassName, string sTxtvalue)
        {
            Console.WriteLine("Going to Get teh Text Field");
            TextBox txtField = wVStoreWin.Get <TextBox>(SearchCriteria.ByClassName(sClassName));

            txtField.Focus();
            txtField.Enter(sTxtvalue);
            wVStoreWin.WaitWhileBusy();
            Thread.Sleep(2000);
        }
コード例 #19
0
        public void ActivateEndpointExplorer()
        {
            var endpoint      = ServiceControlStub.ServiceControl.StubServiceUrl;
            var queueExplorer = _barManager.Get <GroupBox>(SearchCriteria.ByClassName("LayoutPanel").AndAutomationId("QueueExplorer"));
            var computerNode  = (TreeNode)queueExplorer.Get(SearchCriteria.ByText(endpoint));

            computerNode.Focus();
            computerNode.CollapseNode();
            computerNode.ExpandNode();
        }
コード例 #20
0
ファイル: CalcDetailedForm.cs プロジェクト: alapshov/vsk
 /// <summary>
 /// Результаты реестров расчета
 /// </summary>
 public ReadDataCalc RegistryResult()
 {
     Trace("CalcDetailedForm: Получаем данные из таблицы реестра расчетов");
     if (IsDialogErrorShow())
     {
         Assert.Fail(_dialogMsg.Items[2].Name);
     }
     Wait.SpinWait(_calcDetailedForm, SearchCriteria.ByClassName("DataGridRow"));
     return(GetRowFromDataGrid(AppManager.Instance.MainWindow.Get <ListView>(SearchCriteria.ByAutomationId("DGrid"))));
 }
コード例 #21
0
        public void GivenIHaveWritenSomethingInTheEditingArea()
        {
            SearchCriteria searchCriteria = SearchCriteria
                                            .ByClassName("Edit");

            TextBox textBox = (TextBox)window.Get(searchCriteria);

            textBox.Text = "TEST DE TEST :)";

            Assert.AreEqual(1, 1);
        }
コード例 #22
0
        public void Verify_Excel()
        {
            Wait();
            Application _app1   = Application.Attach("EXCEL");
            Window      winExcl = _app1.GetWindow(SearchCriteria.ByClassName("XLMAIN"), InitializeOption.NoCache);

            Assert.IsTrue(winExcl.TitleBar.Name.Contains("Excel"));
            logger.Info("Verified related Excel is downloaded and opened");
            //Wait();
            _app1.Close();
            logger.Info("Closing Excel");
        }
コード例 #23
0
 //Open CloudCompare.exe
 private void CloudCompare(String action)
 {
     if (action == "open")
     {
         applicationCloudCompare = Application.Launch(PATH_FOLDER + "CloudCompare");
         mainWindow = applicationCloudCompare.GetWindow(SearchCriteria.ByClassName("Qt5QWindowIcon"), TestStack.White.Factory.InitializeOption.WithCache);
         mainWindow.WaitWhileBusy();
     }
     else if (action == "close")
     {
         applicationCloudCompare.Close();
     }
 }
コード例 #24
0
ファイル: FourthPage.cs プロジェクト: Zeroshi/PlugnPlay
        public void tstGrid()
        {
            setupapp();
            Window mainWindow = application.GetWindow("MainWindow");

            TestStack.White.UIItems.TabItems.TabPage tabInput = mainWindow.Get <White.UIItems.TabItems.TabPage>(SearchCriteria.ByText("Data Grid"));
            tabInput.Click();
            ListView dataGrid = mainWindow.Get <ListView>(SearchCriteria.ByClassName("DataGrid"));
            var      row      = dataGrid.Rows[2];

            row.Select();
            Thread.Sleep(3000);
        }
コード例 #25
0
        private SearchCriteria GetSearchCriteria()
        {
            var by = context.Request.QueryString["by"];

            if (string.IsNullOrEmpty(by))
            {
                throw new ParameterMissingException("by");
            }

            switch (by)
            {
            case "automationid":
                var automationId = context.Request.QueryString["1"];
                if (string.IsNullOrEmpty(automationId))
                {
                    throw new ParameterMissingException("automation id", 1);
                }

                return(SearchCriteria.ByAutomationId(automationId));

            case "text":
                var text = context.Request.QueryString["1"];
                if (string.IsNullOrEmpty(text))
                {
                    throw new ParameterMissingException("text");
                }

                return(SearchCriteria.ByText(text));

            case "classname":
                var className = context.Request.QueryString["1"];
                if (string.IsNullOrEmpty(className))
                {
                    throw new ParameterMissingException("class name");
                }

                return(SearchCriteria.ByClassName(className));

            case "framework":
                var framework = context.Request.QueryString["1"];
                if (string.IsNullOrEmpty(framework))
                {
                    throw new ParameterMissingException("framework");
                }

                return(SearchCriteria.ByFramework(framework));

            default:
                throw new InputException("Incorrect value for 'by'");
            }
        }
コード例 #26
0
ファイル: EC4BaseClass.cs プロジェクト: ZeroTull/EC4
 public void ec4Main()
 {
     EC4                       = Application.Launch(@"D:\EchoContactClient.Host.exe.lnk");
     loginWindow               = EC4.GetWindow(SearchCriteria.ByClassName("Window"), InitializeOption.NoCache);
     loginTextBox              = loginWindow.Get <TextBox>(SearchCriteria.ByAutomationId("LoginField"));
     passwordField             = loginWindow.Get <TextBox>(SearchCriteria.ByAutomationId("PasswordField"));
     clientField               = loginWindow.Get <TextBox>(SearchCriteria.ByAutomationId("ClientField"));
     rememberMeCheckBox        = loginWindow.Get <CheckBox>(SearchCriteria.ByClassName("CheckBox"));
     loginButton               = loginWindow.Get <Button>(SearchCriteria.ByAutomationId("LoginButton"));
     deskSelection             = loginWindow.Get <ComboBox>(SearchCriteria.ByAutomationId("deskSelectionCombobox"));
     makeMeImmediatlyAvailable = loginWindow.Get <CheckBox>(SearchCriteria.ByAutomationId("makeMeImmediatelyAvailableCheckBox"));
     OkButton                  = loginWindow.Get <Button>(SearchCriteria.ByAutomationId("OkButton"));
     AgentDashBoard            = EC4.GetWindow(SearchCriteria.ByAutomationId("AgentDashboard"), InitializeOption.NoCache);
 }
コード例 #27
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);
     }
 }
コード例 #28
0
        public void SelectKM(string kmName)
        {
            Panel    TaskType = advanceSearch.Get <Panel>(SearchCriteria.ByAutomationId("ehKnowledgeSpecialist"));
            ComboBox cb       = TaskType.Get <ComboBox>(SearchCriteria.ByAutomationId("CheckableCombo"));

            cb.Click();

            foreach (ListItem v in cb.Items)
            {
                CheckBox kM = v.Get <CheckBox>(SearchCriteria.ByClassName("CheckBox"));
                if (kM.Name.ToString() == kmName)
                {
                    kM.Click(); break;
                }
            }
        }
コード例 #29
0
        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();
        }
コード例 #30
0
ファイル: SearchPage.cs プロジェクト: qatesting/pscautomation
        //Getting the values in Search
        public int FindNumberOfSearchPatients()
        {
            int count = 0;

            try
            {
                ListBox listBox = searchwindow.Get <ListBox>(SearchCriteria.ByClassName("ListBox"));
                count = listBox.Items.Count;
                return(count);
            }
            catch (Exception)
            {
                Console.WriteLine("No Patient Found");
                return(count);
            }
        }