/// <summary>
        /// test2
        /// </summary>
        public void RecordedMethod2()
        {
            #region Variable Declarations
            WinControl uIToDoRailsandAngularGDocument = this.UIToDoRailsandAngularGWindow.UIToDoRailsandAngularGDocument;
            #endregion

            // Click 'ToDo Rails and Angular - Google Chrome' document
            Mouse.Click(uIToDoRailsandAngularGDocument, new Point(573, 153));

            // Type 'test 3' in 'ToDo Rails and Angular - Google Chrome' document
            Keyboard.SendKeys(uIToDoRailsandAngularGDocument, this.RecordedMethod2Params.UIToDoRailsandAngularGDocumentSendKeys, ModifierKeys.None);

            // Click 'ToDo Rails and Angular - Google Chrome' document
            Mouse.Click(uIToDoRailsandAngularGDocument, new Point(1322, 166));

            // Click 'ToDo Rails and Angular - Google Chrome' document
            Mouse.Click(uIToDoRailsandAngularGDocument, new Point(1112, 315));

            // Click 'ToDo Rails and Angular - Google Chrome' document
            Mouse.Click(uIToDoRailsandAngularGDocument, new Point(651, 310));

            // Type 'subtest 3' in 'ToDo Rails and Angular - Google Chrome' document
            Keyboard.SendKeys(uIToDoRailsandAngularGDocument, this.RecordedMethod2Params.UIToDoRailsandAngularGDocumentSendKeys1, ModifierKeys.None);

            // Click 'ToDo Rails and Angular - Google Chrome' document
            Mouse.Click(uIToDoRailsandAngularGDocument, new Point(546, 428));

            // Click 'ToDo Rails and Angular - Google Chrome' document
            Mouse.Click(uIToDoRailsandAngularGDocument, new Point(1048, 660));
        }
Esempio n. 2
0
        /// <summary>
        /// dangnhap
        /// </summary>
        public void RecordedMethod1()
        {
            #region Variable Declarations
            WinControl uIAllWork1sGoogleChromDocument = this.UIAllWork1sGoogleChromWindow.UIChromeLegacyWindowWindow.UIAllWork1sGoogleChromDocument;
            WinEdit    uIItemEdit = this.UIAllWork1sGoogleChromWindow.UIItemGroup.UIItemEdit;
            WinGroup   uIAllWork1sGoogleChromGroup = this.UIAllWork1sGoogleChromWindow.UIItemGroup.UIAllWork1sGoogleChromGroup;
            WinText    uIAllWork1sGoogleChromText  = this.UIAllWork1sGoogleChromWindow.UIỨngViênTanhuynh1999MenuButton.UIAllWork1sGoogleChromText;
            WinText    uIAllWork1sGoogleChromText1 = this.UIAllWork1sGoogleChromWindow.UIĐăngxuấtHyperlink.UIAllWork1sGoogleChromText;
            #endregion

            // Click 'AllWork1s - Google Chrome' document
            Mouse.Click(uIAllWork1sGoogleChromDocument, new Point(876, 337));

            // Click '******************' text box
            Mouse.Click(uIItemEdit, new Point(340, 24));

            // Click 'AllWork1s - Google Chrome' group
            Mouse.Click(uIAllWork1sGoogleChromGroup, new Point(421, 27));

            // Click 'AllWork1s - Google Chrome' label
            Mouse.Click(uIAllWork1sGoogleChromText, new Point(68, 11));

            // Click 'AllWork1s - Google Chrome' label
            Mouse.Click(uIAllWork1sGoogleChromText1, new Point(34, 1));
        }
Esempio n. 3
0
        /// <summary>
        /// EmptyNewRegExpr_ThrowsExceptionParams - Используйте "EmptyNewRegExpr_ThrowsExceptionParamsParams" для передачи параметров в этот метод.
        /// </summary>
        public void EmptyNewRegExpr_ThrowsExceptionParams()
        {
            #region Variable Declarations
            WinComboBox uICmbPatternsComboBox = this.UIForm1Window.UICmbPatternsWindow.UICmbPatternsComboBox;
            WinEdit     uITxtNewRegExpEdit    = this.UIForm1Window.UITxtNewRegExpWindow.UITxtNewRegExpEdit;
            WinButton   uIОбновитьButton      = this.UIForm1Window.UIОбновитьWindow.UIОбновитьButton;
            WinControl  uIItemDialog          = this.UIItemWindow.UIItemWindow1.UIItemDialog;
            WinButton   uIОКButton            = this.UIОКWindow.UIОКButton;
            WinButton   uIЗакрытьButton       = this.UIForm1Window.UIForm1TitleBar.UIЗакрытьButton;
            #endregion

            // Выберите "XYZ | XYZ | XYZ" в "cmbPatterns" поле со списком
            uICmbPatternsComboBox.SelectedItem = this.EmptyNewRegExpr_ThrowsExceptionParamsParams.UICmbPatternsComboBoxSelectedItem;

            // Тип "" в "txtNewRegExp" надпись
            uITxtNewRegExpEdit.Text = this.EmptyNewRegExpr_ThrowsExceptionParamsParams.UITxtNewRegExpEditText;

            // Щелкните "Обновить" кнопка
            Mouse.Click(uIОбновитьButton, new Point(29, 16));

            // Щелкните Dialog
            Mouse.Click(uIItemDialog, new Point(115, 105));

            // Щелкните "ОК" кнопка
            Mouse.Click(uIОКButton, new Point(58, 13));

            // Щелкните "Закрыть" кнопка
            Mouse.Click(uIЗакрытьButton, new Point(14, 10));
        }
Esempio n. 4
0
        /// <summary>
        ///     QuoteResults - Use 'QuoteResultsParams' to pass parameters into this method.
        /// </summary>
        public void QuoteResults()
        {
            WinControl  uIOKButton             = UIProposerDetailsWindow.UIOKWindow.UIOKButton;
            WinComboBox uIItemComboBox         = UIDriverDetailsWindow.UIItemWindow.UIItemComboBox;
            WinComboBox uIItemComboBox1        = UIDriverDetailsWindow.UIItemWindow1.UIItemComboBox;
            WinEdit     uIItemEdit             = UIDriverDetailsWindow.UIItemWindow2.UIItemEdit;
            WinControl  uIOKButton1            = UIDriverDetailsWindow.UIOKWindow.UIOKButton;
            WinEdit     uIItemEdit2            = UIInsurEtamWindow.UIQuotesWindow.UIItemWindow.UIItemEdit;
            WinControl  uICalculateQuoteButton = UIInsurEtamWindow.UIQuotesWindow.UICalculateQuoteWindow.UICalculateQuoteButton;
            WinEdit     uIItemEdit3            = map.UIInsurEtamWindow.UIQuotesWindow.UICarRegistrationWindow.UIItemEdit;

            Mouse.Click(uIOKButton);

            uIItemComboBox.SelectedItem = QuoteResultsParams.JobTitle;

            uIItemComboBox1.SelectedItem = QuoteResultsParams.JobSector;

            uIItemEdit.Text = QuoteResultsParams.LicenceDate;

            Mouse.Click(uIOKButton1, new Point(38, 4));

            VehicleLookup();

            uIItemEdit2.Text = QuoteResultsParams.VehicleCost;

            uIItemEdit3.Text = QuoteResultsParams.CarRegFordFiesta;

            Mouse.Click(uICalculateQuoteButton);
        }
 /// <summary>
 /// Mouse Left click on given UI control
 /// </summary>
 /// <param name="uiControl">Control to be clicked</param>
 /// <param name="checkEnabled"></param>
 public static void Click(this WinControl uiControl, bool checkEnabled = true)
 {
     try
     {
         if (uiControl.Exists)
         {
             if (checkEnabled)
             {
                 if (uiControl.Enabled)
                 {
                     uiControl.WaitForControlEnabled();
                     Mouse.Click(uiControl);
                 }
                 else
                 {
                     Assert.Fail("Failed to perform Click operation, control not enabled in UI");
                 }
             }
             else
             {
                 uiControl.WaitForControlExist();
                 Mouse.Click(uiControl);
             }
         }
         else
         {
             Assert.Fail("Failed to perform Click operation, control not available in UI");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         throw ex;
     }
 }
        /// <summary>
        /// Success scenario
        /// </summary>
        public void adminLogin()
        {
            #region Variable Declarations
            WinClient  uIChromeLegacyWindowClient     = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow.UIChromeLegacyWindowClient;
            WinControl uIGradePerformanceAnalDocument = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow.UIGradePerformanceAnalDocument;
            WinControl uIChromeLegacyWindowDocument   = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow.UIChromeLegacyWindowDocument;
            WinButton  uIItemButton = this.UIItemWindow.UIItemComboBox.UIItemButton;
            #endregion

            // Click 'Chrome Legacy Window' client
            Mouse.Click(uIChromeLegacyWindowClient, new Point(682, 250));

            // Type 'a' in 'Grade Performance Analyzer - Google Chrome' document
            Keyboard.SendKeys(uIGradePerformanceAnalDocument, this.adminLoginParams.UIGradePerformanceAnalDocumentSendKeys, ModifierKeys.None);

            // Type 'dmin' in 'Chrome Legacy Window' document
            Keyboard.SendKeys(uIChromeLegacyWindowDocument, this.adminLoginParams.UIChromeLegacyWindowDocumentSendKeys, ModifierKeys.None);

            // Click 'Chrome Legacy Window' document
            Mouse.Click(uIChromeLegacyWindowDocument, new Point(646, 353));

            // Type 'admin' in 'Chrome Legacy Window' document
            Keyboard.SendKeys(uIChromeLegacyWindowDocument, this.adminLoginParams.UIChromeLegacyWindowDocumentSendKeys1, ModifierKeys.None);

            // Click 'Chrome Legacy Window' document
            Mouse.Click(uIChromeLegacyWindowDocument, new Point(774, 431));

            // Click button
            Mouse.Click(uIItemButton, new Point(26, 17));
        }
Esempio n. 7
0
        /// <summary>
        /// AddingNewCategory - Use 'AddingNewCategoryParams' to pass parameters into this method.
        /// </summary>
        public void AddingNewCategory()
        {
            #region Variable Declarations
            WinPane    uIListakategoriimojaapPane     = this.UIListakategoriimojaapWindow.UIListakategoriimojaapPane;
            WinPane    uIHomePagemojaaplikacjPane     = this.UIListakategoriimojaapWindow.UIHomePagemojaaplikacjPane;
            WinPane    uICreatemojaaplikacjapPane     = this.UIListakategoriimojaapWindow.UICreatemojaaplikacjapPane;
            WinControl uICreatemojaaplikacjapDocument = this.UIListakategoriimojaapWindow.UIChromeLegacyWindowWindow.UICreatemojaaplikacjapDocument;
            #endregion

            // Click 'Lista kategorii — moja aplikacja platformy ASP.NET...' pane
            Mouse.Click(uIListakategoriimojaapPane, new Point(416, 225));

            // Launch '%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PrivateAssemblies\ScriptedSandbox64.exe' with arguments '"Software\Microsoft\VisualStudio\15.0_5bd3f5c7\ScriptedPlugins" "Software\Microsoft\VisualStudio\15.0_5bd3f5c7_Config\ScriptedPlugins" 1098e 2f24 "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/PrivateAssemblies/plugin.vs.js"'
            ApplicationUnderTest scriptedSandbox64Application = ApplicationUnderTest.Launch(this.AddingNewCategoryParams.ExePath, this.AddingNewCategoryParams.AlternateExePath, "\"Software\\Microsoft\\VisualStudio\\15.0_5bd3f5c7\\ScriptedPlugins\" \"Software\\Microso" +
                                                                                            "ft\\VisualStudio\\15.0_5bd3f5c7_Config\\ScriptedPlugins\" 1098e 2f24 \"C:/Program Fil" +
                                                                                            "es (x86)/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/PrivateAssemblies/p" +
                                                                                            "lugin.vs.js\"");

            // Click 'Home Page — moja aplikacja platformy ASP.NET - Goo...' pane
            Mouse.Click(uIHomePagemojaaplikacjPane, new Point(816, 128));

            // Click 'Lista kategorii — moja aplikacja platformy ASP.NET...' pane
            Mouse.Click(uIListakategoriimojaapPane, new Point(439, 225));

            // Click 'Create — moja aplikacja platformy ASP.NET - Google...' pane
            Mouse.Click(uICreatemojaaplikacjapPane, new Point(670, 280));

            // Type 'Kategoria 8' in 'Create — moja aplikacja platformy ASP.NET - Google...' document
            Keyboard.SendKeys(uICreatemojaaplikacjapDocument, this.AddingNewCategoryParams.UICreatemojaaplikacjapDocumentSendKeys, ModifierKeys.None);

            // Click 'Create — moja aplikacja platformy ASP.NET - Google...' pane
            Mouse.Click(uICreatemojaaplikacjapPane, new Point(633, 343));
        }
Esempio n. 8
0
        /// <summary>
        ///     Try to collapse the control using the ExpandCollapsePattern
        /// </summary>
        /// <param name="control">The target control.</param>
        /// <returns>True if the operation succeed, false otherwise.</returns>
        public static bool TryCollapse(this WinControl control)
        {
            try
            {
                var automationElement = control.NativeElement as AutomationElement;
                if (automationElement == null)
                {
                    return(false);
                }

                object objectPattern;
                if (!automationElement.TryGetCurrentPattern(ExpandCollapsePattern.Pattern, out objectPattern))
                {
                    return(false);
                }
                var pattern = objectPattern as ExpandCollapsePattern;

                if (pattern != null &&
                    pattern.Current.ExpandCollapseState != ExpandCollapseState.Collapsed &&
                    pattern.Current.ExpandCollapseState != ExpandCollapseState.LeafNode)
                {
                    pattern.Collapse();
                }

                return(true);
            }
            catch
            {
            }
            return(false);
        }
Esempio n. 9
0
        /// <summary>
        ///     Try to select the control using the SelectionItemPattern
        /// </summary>
        /// <param name="control">The target control.</param>
        /// <returns>True if the operation succeed, false otherwise.</returns>
        public static bool TrySelect(this WinControl control)
        {
            try
            {
                AutomationElement automationElement = GetAutomationElement(control);
                if (automationElement == null)
                {
                    return(false);
                }

                object objectPattern;
                if (!automationElement.TryGetCurrentPattern(SelectionItemPattern.Pattern, out objectPattern))
                {
                    return(false);
                }
                var pattern = objectPattern as SelectionItemPattern;

                if (pattern != null)
                {
                    pattern.Select();
                }
                return(true);
            }
            catch
            {
            }

            return(false);
        }
Esempio n. 10
0
        /// <summary>
        ///     Try to set the value to the control using the ValuePattern.
        /// </summary>
        /// <param name="valueToSet"></param>
        /// <param name="control">The target control.</param>
        /// <returns>True if the operation succeed, false otherwise.</returns>
        public static bool TrySetValue(this WinControl control, string valueToSet)
        {
            try
            {
                var automationElement = control.NativeElement as AutomationElement;
                if (automationElement == null)
                {
                    return(false);
                }

                object objectPattern;
                if (!automationElement.TryGetCurrentPattern(ValuePattern.Pattern, out objectPattern))
                {
                    return(false);
                }

                var pattern = objectPattern as ValuePattern;

                if (pattern != null)
                {
                    pattern.SetValue(valueToSet);
                }

                return(true);
            }
            catch
            {
            }
            return(false);
        }
Esempio n. 11
0
        /// <summary>
        ///     Try to call the invoke pattern on the target control.
        /// </summary>
        /// <param name="control">The target control.</param>
        /// <returns>True if the operation succeed, false otherwise.</returns>
        public static bool TryInvoke(this WinControl control)
        {
            try
            {
                var automationElement = control.NativeElement as AutomationElement;
                if (automationElement == null)
                {
                    return(false);
                }

                object objectPattern;
                if (!automationElement.TryGetCurrentPattern(InvokePattern.Pattern, out objectPattern))
                {
                    return(false);
                }
                var pattern = objectPattern as InvokePattern;

                if (pattern != null)
                {
                    pattern.Invoke();
                }

                return(true);
            }
            catch
            {
            }
            return(false);
        }
Esempio n. 12
0
File: Robot.cs Progetto: MOONYAN/POS
        public static void SendKeyEnterToOpenFileDialog()
        {
            WinControl control = (WinControl)Robot.FindWinControl(typeof(WinControl), "開啟", null);

            Mouse.Click(control);
            Keyboard.SendKeys("{Enter}");
        }
Esempio n. 13
0
        private static void DumpPropertyExpressions(
            WinControl control, bool traceInsteadOfDebug, IEnumerable <PropertyExpression> propertyExpressionCollection)
        {
            var sb = new StringBuilder();

            sb.AppendFormat("SearchProperties for {0}{1}", control, Environment.NewLine);

            foreach (PropertyExpression sp in propertyExpressionCollection)
            {
                sb.AppendFormat
                    ("  -> {0} {1} {2}{3}",
                    sp.PropertyName,
                    sp.PropertyOperator,
                    sp.PropertyValue,
                    Environment.NewLine);
            }

            if (traceInsteadOfDebug)
            {
                Trace.WriteLine(sb.ToString());
            }
            else
            {
                Debug.WriteLine(sb.ToString());
            }
        }
Esempio n. 14
0
        /// <summary>
        ///     Dump to the output all the supported properties of a Wpf control.
        /// </summary>
        /// <param name="control">The target control.</param>
        /// <param name="traceInsteadOfDebug">Dump to the trace instead of the debug output.</param>
        /// <exception cref="ArgumentNullException">control</exception>
        public static void DumpSupportedProperties(this WinControl control, bool traceInsteadOfDebug = false)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }
            var sb      = new StringBuilder();
            var element = control.NativeElement as AutomationElement;

            sb.AppendFormat("SupportedProperties for {0}{1}", control, Environment.NewLine);
            if (element != null)
            {
                foreach (AutomationProperty sp in element.GetSupportedProperties())
                {
                    sb.AppendFormat
                        ("  -> {0}: {1}{2}",
                        sp.ProgrammaticName,
                        element.GetCurrentPropertyValue(sp),
                        Environment.NewLine);
                }
            }

            if (traceInsteadOfDebug)
            {
                Trace.WriteLine(sb.ToString());
            }
            else
            {
                Debug.WriteLine(sb.ToString());
            }
        }
Esempio n. 15
0
        /// <summary>
        /// RecordedMethod1 - Use 'RecordedMethod1Params' to pass parameters into this method.
        /// </summary>
        public void RecordedMethod1()
        {
            #region Variable Declarations
            WinControl  uIMozillaFirefoxMenuButton = this.UIRunningapplicationsWindow.UIRunningapplicationsToolBar.UIMozillaFirefoxMenuButton;
            WinMenuItem uIMozillaFirefoxMenuItem   = this.UIJumpListWindow.UIItemWindow.UIJumpListClient.UIMozillaFirefoxMenuItem;
            WinEdit     uIItemEdit   = this.UIMozillaFirefoxStartPWindow.UIMozillaFirefoxStartPDocument.UIItemEdit;
            WinEdit     uISearchEdit = this.UIMozillaFirefoxStartPWindow.UISearchButton.UISearchEdit;
            WinEdit     uIW3SchoolsOnlineWebTuEdit = this.UIMozillaFirefoxStartPWindow.UIW3SchoolsOnlineWebTuHyperlink.UIW3SchoolsOnlineWebTuEdit;
            WinControl  uIItemPropertyPage         = this.UIMozillaFirefoxStartPWindow.UIW3SchoolsOnlineWebTuApplication.UIItemPropertyPage;
            #endregion

            // Right-Click 'Mozilla Firefox' MenuButton
            Mouse.Click(uIMozillaFirefoxMenuButton, MouseButtons.Right, ModifierKeys.None, new Point(35, 21));

            // Click 'Mozilla Firefox' menu item
            Mouse.Click(uIMozillaFirefoxMenuItem, new Point(143, 9));

            // Type 'w3schools.com' in text box
            uIItemEdit.Text = this.RecordedMethod1Params.UIItemEditText;

            // Click 'Search' text box
            Mouse.Click(uISearchEdit, new Point(31, 12));

            // Click 'W3Schools Online Web Tutorials' text box
            Mouse.Click(uIW3SchoolsOnlineWebTuEdit, new Point(215, 12));

            // Click PropertyPage
            Mouse.Click(uIItemPropertyPage, new Point(1351, 15));
        }
        /// <summary>
        /// Mouse 'Right Click' on given UI controls Midpoint
        /// </summary>
        /// <param name="uiControl">Control to be clicked</param>
        public static void ClickPoint_RightClick(this WinControl uiControl)
        {
            Console.WriteLine("Right click on control" + uiControl.AccessibleDescription);
            Point pnt = new Point(uiControl.Left + uiControl.Width / 2, uiControl.Top + uiControl.Height / 2);

            Mouse.Click(MouseButtons.Right, System.Windows.Input.ModifierKeys.None, pnt);
        }
        /// <summary>
        /// login success
        /// </summary>
        public void RecordedMethod1()
        {
            #region Variable Declarations
            WinControl uIChromeLegacyWindowDocument  = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow1.UIChromeLegacyWindowDocument;
            WinControl uIChromeLegacyWindowDocument1 = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow1.UIChromeLegacyWindowDocument1;
            WinControl uIChromeLegacyWindowDocument2 = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow1.UIChromeLegacyWindowDocument2;
            WinControl uIChromeLegacyWindowDocument3 = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow1.UIChromeLegacyWindowDocument3;
            WinControl uIChromeLegacyWindowDocument4 = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow1.UIChromeLegacyWindowDocument4;
            WinButton  uIItemButton = this.UIItemWindow.UIItemComboBox.UIItemButton;
            #endregion

            // Click 'Chrome Legacy Window' document
            Mouse.Click(uIChromeLegacyWindowDocument, new Point(524, 243));

            // Type 'admin' in 'Chrome Legacy Window' document
            Keyboard.SendKeys(uIChromeLegacyWindowDocument1, this.RecordedMethod1Params.UIChromeLegacyWindowDocument1SendKeys, ModifierKeys.None);

            // Click 'Chrome Legacy Window' document
            Mouse.Click(uIChromeLegacyWindowDocument2, new Point(714, 354));

            // Type 'admin' in 'Chrome Legacy Window' document
            Keyboard.SendKeys(uIChromeLegacyWindowDocument3, this.RecordedMethod1Params.UIChromeLegacyWindowDocument3SendKeys, ModifierKeys.None);

            // Click 'Chrome Legacy Window' document
            Mouse.Click(uIChromeLegacyWindowDocument4, new Point(744, 424));

            // Click button
            Mouse.Click(uIItemButton, new Point(20, 19));
        }
Esempio n. 18
0
        /// <summary>
        /// RecordedMethod1 - 使用“RecordedMethod1Params”将参数传递到此方法中。
        /// </summary>
        public void RecordedMethod1()
        {
            #region Variable Declarations
            WinWindow  uI登录GoogleChromeWindow1      = this.UI登录GoogleChromeWindow.UI登录GoogleChromeWindow1;
            WinControl uIChromeLegacyWindowDocument = this.UI登录GoogleChromeWindow.UIChromeLegacyWindowWindow.UIChromeLegacyWindowDocument;
            #endregion

            // 单击 “登录 - Google Chrome” 窗口
            Mouse.Click(uI登录GoogleChromeWindow1, new Point(105, 459));

            // 单击 “登录 - Google Chrome” 窗口
            Mouse.Click(uI登录GoogleChromeWindow1, new Point(195, 471));

            // 在 “Chrome Legacy Window” 文档 中键入“{NumPad1}{NumPad5}{NumPad1}{NumPad5}{NumPad8}{NumPad1}{NumPad5}{NumPad5}{NumPad5}{NumPad1}{NumPad1}”
            Keyboard.SendKeys(uIChromeLegacyWindowDocument, this.RecordedMethod1Params.UIChromeLegacyWindowDocumentSendKeys, ModifierKeys.None);

            // 单击 “登录 - Google Chrome” 窗口
            Mouse.Click(uI登录GoogleChromeWindow1, new Point(305, 519));

            // 单击 “登录 - Google Chrome” 窗口
            Mouse.Click(uI登录GoogleChromeWindow1, new Point(159, 519));

            // 在 “Chrome Legacy Window” 文档 中键入“{NumPad1}{NumPad2}{NumPad3}{NumPad4}{NumPad5}{NumPad6}”
            Keyboard.SendKeys(uIChromeLegacyWindowDocument, this.RecordedMethod1Params.UIChromeLegacyWindowDocumentSendKeys1, ModifierKeys.None);

            // 单击 “登录 - Google Chrome” 窗口
            Mouse.Click(uI登录GoogleChromeWindow1, new Point(199, 610));
        }
        /// <summary>
        /// unsuccessful scenario
        /// </summary>
        public void adminLogin2()
        {
            #region Variable Declarations
            WinClient  uIChromeLegacyWindowClient     = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow1.UIChromeLegacyWindowClient;
            WinClient  uIChromeLegacyWindowClient1    = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow2.UIChromeLegacyWindowClient;
            WinControl uIGradePerformanceAnalDocument = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow3.UIGradePerformanceAnalDocument;
            WinControl uIChromeLegacyWindowDocument   = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow4.UIChromeLegacyWindowDocument;
            WinControl uIChromeLegacyWindowDocument1  = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow5.UIChromeLegacyWindowDocument;
            WinControl uIChromeLegacyWindowDocument2  = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow6.UIChromeLegacyWindowDocument;
            WinControl uIChromeLegacyWindowDocument3  = this.UIGradePerformanceAnalWindow.UIChromeLegacyWindowWindow7.UIChromeLegacyWindowDocument;
            #endregion

            // Click 'Chrome Legacy Window' client
            Mouse.Click(uIChromeLegacyWindowClient, new Point(499, 234));

            // Move 'Chrome Legacy Window' client
            Mouse.StartDragging(uIChromeLegacyWindowClient1, new Point(504, 242));
            Mouse.StopDragging(uIChromeLegacyWindowClient1, -5, 0);

            // Type 'a' in 'Grade Performance Analyzer - Google Chrome' document
            Keyboard.SendKeys(uIGradePerformanceAnalDocument, this.adminLogin2Params.UIGradePerformanceAnalDocumentSendKeys, ModifierKeys.None);

            // Type 'dmin' in 'Chrome Legacy Window' document
            Keyboard.SendKeys(uIChromeLegacyWindowDocument, this.adminLogin2Params.UIChromeLegacyWindowDocumentSendKeys, ModifierKeys.None);

            // Click 'Chrome Legacy Window' document
            Mouse.Click(uIChromeLegacyWindowDocument1, new Point(497, 345));

            // Type 'ad' in 'Chrome Legacy Window' document
            Keyboard.SendKeys(uIChromeLegacyWindowDocument2, this.adminLogin2Params.UIChromeLegacyWindowDocumentSendKeys1, ModifierKeys.None);

            // Click 'Chrome Legacy Window' document
            Mouse.Click(uIChromeLegacyWindowDocument3, new Point(790, 432));
        }
Esempio n. 20
0
 private void FindRegDate()
 {
     _regDateWindow = new WinWindow(_docCardWindow);
     _regDateWindow.SearchProperties[WinControl.PropertyNames.ControlName] = "lanDocsDateTimeBox1";
     _regDate = new WinControl(_regDateWindow);
     _regDate.SearchProperties[UITestControl.PropertyNames.ControlType] = "DropDown";
 }
Esempio n. 21
0
        public void TestClicksAndText()
        {
            WinControl newItemDropDownButton = UIMap.UIExplorerTestsWindow
                                               .UIItemWindow1.UINewToolBar.UINewitemDropDownButton;
            WinMenuItem textDocumentMenuItem = UIMap.UIExplorerTestsWindow
                                               .UIItemWindow1.UINewitemClient.UIItemGroup.UITextDocumentMenuItem;
            WinMenuItem folderMenuItem = UIMap.UIExplorerTestsWindow.UIItemWindow1
                                         .UINewitemClient1.UIItemGroup.UIFolderMenuItem;
            WinEdit fileEdit   = UIMap.UIExplorerTestsWindow.UIItemWindow.UIItemEdit;
            WinEdit folderEdit = UIMap.UIExplorerTestsWindow.UIItemWindow2.UIItemEdit;
            WinEdit folder     = UIMap.UIExplorerTestsWindow.UIItemWindow3
                                 .UIWorldListItem.UINameEdit;
            var eyes = new Eyes();

            eyes.SetLogHandler(new StdoutLogHandler(true));
            eyes.BranchName = "demo";
            eyes.Open(UIMap.UIExplorerTestsWindow, "Explorer", "TestClicksAndText", new Size(1000, 700));

            try
            {
                eyes.CheckWindow("Empty folder");

                Mouse.Click(newItemDropDownButton, new Point(60, 15));
                eyes.CheckWindow("New Item");

                Mouse.Click(textDocumentMenuItem);
                eyes.CheckWindow("New Text File");

                fileEdit.Text = "Hello.txt";
                Keyboard.SendKeys(fileEdit, "{Enter}", ModifierKeys.None);
                eyes.CheckWindow("File name set");

                Mouse.Click(newItemDropDownButton, new Point(60, 15));
                eyes.CheckWindow("New Item");

                Mouse.Click(folderMenuItem);
                Mouse.Move(folderEdit, Point.Empty);
                eyes.CheckWindow("New Folder");

                folderEdit.Text = "World";
                Keyboard.SendKeys(folderEdit, "{Enter}", ModifierKeys.None);
                eyes.CheckWindow("Folder name set");

                Mouse.Move(folder, new Point(47, 15));
                eyes.CheckWindow("Folder tool-tip");

                Mouse.Click(folder, MouseButtons.Right, ModifierKeys.None, new Point(47, 15));
                eyes.CheckWindow("Folder context menu");

                Mouse.DoubleClick(folder, new Point(47, 15));
                eyes.CheckWindow("Empty World folder");

                eyes.Close();
            }
            finally
            {
                eyes.AbortIfNotClosed();
            }
        }
        private static IEnhancedWinControl WrapUtil(WinControl control)
        {
            IEnhancedWinControl _con = null;

            if (control.GetType() == typeof(WinButton))
            {
                _con = new EnhancedWinButton();
            }
            else if (control.GetType() == typeof(WinCheckBox))
            {
                _con = new EnhancedWinCheckBox();
            }
            else if (control.GetType() == typeof(WinComboBox))
            {
                _con = new EnhancedWinComboBox();
            }
            else if (control.GetType() == typeof(WinEdit))
            {
                _con = new EnhancedWinEdit();
            }
            else if (control.GetType() == typeof(WinHyperlink))
            {
                _con = new EnhancedWinHyperlink();
            }
            else if (control.GetType() == typeof(WinList))
            {
                _con = new EnhancedWinList();
            }
            else if (control.GetType() == typeof(WinListItem))
            {
                _con = new EnhancedWinListItem();
            }
            else if (control.GetType() == typeof(WinRadioButton))
            {
                _con = new EnhancedWinRadioButton();
            }
            else if (control.GetType() == typeof(WinTable))
            {
                _con = new EnhancedWinTable();
            }
            else if (control.GetType() == typeof(WinCell))
            {
                _con = new EnhancedWinCell();
            }
            else if (control.GetType() == typeof(WinScrollBar))
            {
                _con = new EnhancedWinScrollBar();
            }
            else if (control.GetType() == typeof(WinCustom))
            {
                _con = new EnhancedWinCustom();
            }
            else
            {
                throw new Exception(string.Format("WrapUtil: '{0}' not supported", control.GetType().Name));
            }
            _con.WrapReady(control);
            return(_con);
        }
Esempio n. 23
0
 /// <summary>
 ///     Dump to the output all the filter properties of a Wpf control.
 /// </summary>
 /// <param name="control">The target control.</param>
 /// <param name="traceInsteadOfDebug">Dump to the trace instead of the debug output.</param>
 /// <exception cref="ArgumentNullException">control</exception>
 public static void DumpFilterProperties(this WinControl control, bool traceInsteadOfDebug = false)
 {
     if (control == null)
     {
         throw new ArgumentNullException("control");
     }
     DumpPropertyExpressions(control, traceInsteadOfDebug, control.FilterProperties);
 }
Esempio n. 24
0
 public static WinControl GetChildControl(string name, WinControl parentControl, string type)
 {
     WinControl uIControl = new WinControl(parentControl);
     uIControl.SearchProperties.Add("ControlType", type);
     uIControl.SearchProperties.Add("Name", name);
     uIControl.WaitForControlReady();
     return uIControl;
 }
Esempio n. 25
0
        private static WinControl GetWinControl(string uiTitle, string uiType)
        {
            var htmlcontrol = new WinControl(Browser.Locate(uiTitle, uiType, false));
            var htmlControl = htmlcontrol;

            htmlControl.TechnologyName = TechnologyNameWin;
            return(htmlControl);
        }
        /// <summary>
        /// Testing Director
        /// </summary>
        public void AssertMethod5()
        {
            #region Variable Declarations
            WinControl uIHomePageMovieRatingWMenuButton3 = this.UIHomePageMovieRatingWWindow.UIItemListItem.UIHomePageMovieRatingWMenuButton3;
            #endregion

            // Verify that the 'Name' property of 'Home Page - Movie Rating Web App - Google Chrome' MenuButton equals 'Director'
            Assert.AreEqual(this.AssertMethod5ExpectedValues.UIHomePageMovieRatingWMenuButton3Name, uIHomePageMovieRatingWMenuButton3.Name, "Solution should be Director, otherwise error");
        }
Esempio n. 27
0
        /// <summary>
        ///     Get all the children of a control of a given type.
        ///     It can returns only direct children or all of them.
        /// </summary>
        /// <typeparam name="T">The aimed type of child.</typeparam>
        /// <param name="onlyDirectChildren">Do you want only direct children ?</param>
        /// <param name="control">The target control.</param>
        /// <returns>The children of the aimed type. An empty list if there is none.</returns>
        public static List <T> GetChildren <T>(this WinControl control, bool onlyDirectChildren = true)
            where T : WinControl
        {
            UITestControlCollection children = control.GetChildren();
            var controls = new List <T>();

            GetChildren(children, controls, onlyDirectChildren);
            return(controls);
        }
Esempio n. 28
0
        /// <summary>
        /// 获取窗口某个控件,并点击。适用于控件在窗口中唯一存在
        /// </summary>
        /// <param name="controltype">控件类型</param>
        /// 如梦:"DropDownButton"
        public void WindowControlTypeClick(string controltype)
        {
            //WinSplitButton
            //UIItemWindow

            WinSplitButton wsb = new WinSplitButton(browser);
            WinControl     wc  = new WinControl(wsb);

            wc.SearchProperties[WinControl.PropertyNames.ControlType] = controltype;
            Mouse.Click(wc);
        }
Esempio n. 29
0
        internal static void SetSearchProperties(this WinControl control, ICollection <SearchCriteriaModel> searchCriteria)
        {
            if (!searchCriteria.Any())
            {
                throw new ArgumentException();
            }

            var properties = searchCriteria.Select(c => new PropertyExpression(c.Property.ToString(), c.Value, GetPropertyExpressionOperator(c))).ToArray();

            control.SearchProperties.AddRange(properties);
        }
Esempio n. 30
0
 public LoadPresetsWindow()
 {
     InitializeComponent();
     WinControl.MainBody.Content = WinControl.MainContent;
     WinControl.SetTitle("X360CE - Load Preset");
     WinControl.SetHead("Load Preset");
     WinControl.SetBodyInfo("Select Preset and press [Load Selected] button.");
     WinControl.SetImage(Icons_Default.Icon_gamepad);
     WinControl.SetButton1("Load Selected", Icons_Default.Icon_ok);
     WinControl.SetButton2("Cancel", Icons_Default.Icon_close);
     WinControl.SetButton3();
 }
Esempio n. 31
0
        /// <summary>
        /// NegativeOPenCashDeskWithoutCashHouse
        /// </summary>
        public void NegativeOPenCashDeskWithoutCashHouse()
        {
            #region Variable Declarations
            WinControl uIAdjuvantQAHomeOperaApplication = this.UIAdjuvantQAHomeOperaWindow.UIAdjuvantQAHomeOperaApplication;
            #endregion

            // Click 'Adjuvant QA | Home - Opera' Application
            Mouse.Click(uIAdjuvantQAHomeOperaApplication, new Point(159, 231));

            // Click 'Adjuvant QA | Home - Opera' Application
            Mouse.Click(uIAdjuvantQAHomeOperaApplication, new Point(172, 458));
        }
Esempio n. 32
0
        public static WinControl GetButtonGroupControl(string name, string type, WinWindow parent)
        {
            WinGroup buttonGroup = new WinGroup(parent);
            buttonGroup.SearchProperties.Add("Name", "ButtonGroup");
            buttonGroup.SearchProperties.Add("ControlType", "Group");
            buttonGroup.WaitForControlReady();

            WinControl uIControl = new WinControl(buttonGroup);
            uIControl.SearchProperties.Add("ControlType", type);
            uIControl.SearchProperties.Add("Name", name);
            uIControl.WaitForControlReady();

            return uIControl;
        }
        /// <summary>
        /// Create a _Win* control based on the type of provided WinControl.
        /// </summary>
        /// <param name="control"></param>
        /// <returns></returns>
        public static IEnhancedWinControl Create(WinControl control)
        {
            string Prefix = ".Enhanced";
            string controlTypeName = control.GetType().Name;
            string Namespace = typeof(EnhancedWinControlFactory).Namespace;

            // Get  type based on WinControl type and namespace
            Type Type = Type.GetType(Namespace + Prefix + controlTypeName);

            // The type will be null if it does not exist
            if (Type == null)
            {
                throw new Exception(string.Format("Control Type '{0}' not supported", control.GetType().Name));
            }

            // Create  control
            var enhancedControl = (IEnhancedWinControl)Activator.CreateInstance(Type);

            // Wrap WinControl
            enhancedControl.WrapReady(control);

            return enhancedControl;
        }
Esempio n. 34
0
 public static WinControl GetRightClickControl(string name, string type)
 {
     WinWindow uIWindow = new WinWindow();
     uIWindow.SearchProperties[WinWindow.PropertyNames.AccessibleName] = "Context";
     uIWindow.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32768";
     uIWindow.WaitForControlReady();
     WinMenu uIMenu = new WinMenu(uIWindow);
     uIMenu.SearchProperties[WinMenu.PropertyNames.Name] = "Context";
     uIMenu.WaitForControlReady();
     WinControl uIControl = new WinControl(uIMenu);
     uIControl.SearchProperties.Add("ControlType", type);
     uIControl.SearchProperties.Add("Name", name);
     uIControl.WaitForControlReady();
     return uIControl;
 }
Esempio n. 35
0
 public static WinControl GetItemWindowControl(string name, string type, WinWindow parent)
 {
     WinWindow itemWindow = new WinWindow(parent);
     itemWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains));
     itemWindow.SearchProperties[WinWindow.PropertyNames.Instance] = "11";
     itemWindow.WaitForControlReady();
     WinControl uIControl = new WinControl(itemWindow);
     uIControl.SearchProperties.Add("ControlType", type);
     uIControl.SearchProperties.Add("Name", name);
     uIControl.WaitForControlReady();
     return uIControl;
 }
Esempio n. 36
0
 public static WinControl GetItemControl(string name, string type, WinWindow parent)
 {
     WinWindow ItemWindow = new WinWindow(parent);
     ItemWindow.SearchProperties.Add("AccessibleName", name);
     ItemWindow.WaitForControlReady();
     WinControl uIControl = new WinControl(ItemWindow);
     uIControl.SearchProperties.Add("ControlType", type);
     uIControl.SearchProperties.Add("Name", name);
     uIControl.WaitForControlReady();
     return uIControl;
 }
Esempio n. 37
0
 public static WinControl GetChildTreeItemControl(string name, WinControl parent)
 {
     WinControl uIControl = new WinControl(parent);
     uIControl.SearchProperties.Add("ControlType", "TreeItem");
     uIControl.SearchProperties.Add("Name", name);
     uIControl.WaitForControlReady();
     return uIControl;
 }
Esempio n. 38
0
        public static void SetControlValue(string name, string type, string value, WinWindow parent)
        {
            WinControl uIControl;
            uIControl = new WinControl(parent);
            uIControl.TechnologyName = "MSAA";
            uIControl.SearchProperties.Add("ControlType", type);
            uIControl.SearchProperties.Add("Name", name, PropertyExpressionOperator.Contains);
            uIControl.WaitForControlReady();

            if (type == "CheckBox")
            {
                WinCheckBox mUICheckBox = new WinCheckBox(uIControl);
                mUICheckBox.Checked = Convert.ToBoolean(value);
            }
            else if (type == "Edit")
            {
                WinEdit mUIEdit = new WinEdit(uIControl);
                mUIEdit.Text = value;
            }
        }
        public HtmlCustom PrintToWord()
        {
            WinControl IES = new WinControl();
            IES.SearchProperties[WinControl.PropertyNames.ClassName] = "Internet Explorer_Server";
            IES.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));

            Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument Doc = new Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument(IES);
            Doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Id] = null;
            Doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.RedirectingPage] = "False";
            Doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FrameDocument] = "False";
            Doc.FilterProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Title] = "Beam Analysis Report";
            Doc.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));

            HtmlCustom PrintWordButton = new HtmlCustom(Doc);
            PrintWordButton.SearchProperties["TagName"] = "A";
            PrintWordButton.SearchProperties["Id"] = "btnPrint";
            PrintWordButton.SearchProperties[UITestControl.PropertyNames.Name] = null;
            PrintWordButton.FilterProperties["Class"] = "clsTabBtn";
            PrintWordButton.FilterProperties["ControlDefinition"] = "style=\"COLOR: darkblue\" id=btnPrint clas";
            PrintWordButton.FilterProperties["TagInstance"] = "3";
            PrintWordButton.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));

            return PrintWordButton;
        }
Esempio n. 40
0
        /// <summary>
        /// 获取窗口某个控件,并点击。适用于控件在窗口中唯一存在
        /// </summary>
        /// <param name="controltype">控件类型</param>
        /// 如梦:"DropDownButton"
        public void WindowControlTypeClick(string controltype)
        {
            //WinSplitButton
            //UIItemWindow

            WinSplitButton wsb = new WinSplitButton(browser);
            WinControl wc = new WinControl(wsb);
            wc.SearchProperties[WinControl.PropertyNames.ControlType] = controltype;
            Mouse.Click(wc);
        }
Esempio n. 41
0
 public static WinControl GetTabGroupedControl(string name, string type, string tabName, string group, WinWindow parent)
 {
     WinWindow uITab = new WinWindow(parent);
     uITab.SearchProperties.Add("ControlName", tabName);
     uITab.SearchProperties.Add("ControlType", "Window");
     uITab.WaitForControlReady();
     WinGroup uIGroup = new WinGroup(uITab);
     uIGroup.SearchProperties.Add("Name", group);
     uIGroup.WaitForControlReady();
     WinControl uIControl = new WinControl(uIGroup);
     uIControl.SearchProperties.Add("ControlType", type);
     uIControl.SearchProperties.Add("Name", name);
     uIControl.WaitForControlReady();
     return uIControl;
 }
Esempio n. 42
0
 public static WinControl GetTreeItemControl(string name, WinWindow parent)
 {
     WinWindow treeWindow = new WinWindow(parent);
     treeWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "Tree", PropertyExpressionOperator.Contains));
     treeWindow.WaitForControlReady();
     WinControl uIControl = new WinControl(treeWindow);
     uIControl.SearchProperties.Add("ControlType", "TreeItem");
     uIControl.SearchProperties.Add("Name", name);
     uIControl.WaitForControlReady();
     return uIControl;
 }
        public void CloseOpenGrid(string GridName)
        {
            switch (GridName)
            {
                case "BeamWellGroupConfig":
                    {
                        WinWindow ConfigWindow = new WinWindow(GetMainWindow());
                        ConfigWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        //ConfigWindow.SearchProperties[WinWindow.PropertyNames.ControlId] = "203";
                        ConfigWindow.WindowTitles.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString());

                        WinControl ButtonImage = new WinControl(ConfigWindow);
                        ButtonImage.SearchProperties[UITestControl.PropertyNames.Name] = "Beam Well Group Configuration";
                        ButtonImage.SearchProperties[UITestControl.PropertyNames.ControlType] = "Image";
                        ButtonImage.WindowTitles.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString());
                        Mouse.Click(ButtonImage);
                        Trace.WriteLine("Clicked Grid " + GridName);
                        System.Threading.Thread.Sleep(2000);
                        Mouse.Click(ButtonImage);
                        Trace.WriteLine("Clicked Grid " + GridName);

                        break;
                    }
                case "MOP":
                    {
                        WinWindow ConfigWindow = new WinWindow(GetMainWindow());
                        ConfigWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        //ConfigWindow.SearchProperties[WinWindow.PropertyNames.ControlId] = "202";
                        ConfigWindow.WindowTitles.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString());

                        WinControl ButtonImage = new WinControl(ConfigWindow);
                        ButtonImage.SearchProperties[UITestControl.PropertyNames.Name] = "Well Status/MOP/Type History";
                        ButtonImage.SearchProperties[UITestControl.PropertyNames.ControlType] = "Image";
                        ButtonImage.WindowTitles.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString());
                        Mouse.Click(ButtonImage);
                        Trace.WriteLine("Clicked Grid " + GridName);
                        System.Threading.Thread.Sleep(2000);
                        Mouse.Click(ButtonImage);
                        Trace.WriteLine("Clicked Grid " + GridName);

                        break;
                    }
                case "ESPGroupConfigGrid":
                    {
                        WinWindow ConfigWindow = new WinWindow(GetMainWindow());
                        ConfigWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        //ConfigWindow.SearchProperties[WinWindow.PropertyNames.ControlId] = "203";
                        ConfigWindow.WindowTitles.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString());

                        WinControl ButtonImage = new WinControl(ConfigWindow);
                        ButtonImage.SearchProperties[UITestControl.PropertyNames.Name] = "ESP Well Group Configuration";
                        ButtonImage.SearchProperties[UITestControl.PropertyNames.ControlType] = "Image";
                        ButtonImage.WindowTitles.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString());
                        Mouse.Click(ButtonImage);
                        Trace.WriteLine("Clicked Grid " + GridName);
                        System.Threading.Thread.Sleep(2000);
                        Mouse.Click(ButtonImage);
                        Trace.WriteLine("Clicked Grid " + GridName);

                        break;
                    }
                case "PCPGroupConfigGrid":
                    {
                        WinWindow ConfigWindow = new WinWindow(GetMainWindow());
                        ConfigWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        //ConfigWindow.SearchProperties[WinWindow.PropertyNames.ControlId] = "203";
                        ConfigWindow.WindowTitles.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString());

                        WinControl ButtonImage = new WinControl(ConfigWindow);
                        ButtonImage.SearchProperties[UITestControl.PropertyNames.Name] = "PCP Well Group Configuration";
                        ButtonImage.SearchProperties[UITestControl.PropertyNames.ControlType] = "Image";
                        ButtonImage.WindowTitles.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString());
                        Mouse.Click(ButtonImage);
                        Trace.WriteLine("Clicked Grid " + GridName);
                        System.Threading.Thread.Sleep(2000);
                        Mouse.Click(ButtonImage);
                        Trace.WriteLine("Clicked Grid " + GridName);

                        break;
                    }
                //PCPGroupConfigGrid

            }
            WinWindow ContxtMenu = new WinWindow();
            ContxtMenu.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
            ContxtMenu.SearchProperties[WinWindow.PropertyNames.AccessibleName] = "Context";
            ContxtMenu.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32768";

            WinMenu UiContextMenu = new WinMenu(ContxtMenu);
            UiContextMenu.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
            UiContextMenu.SearchProperties[WinMenu.PropertyNames.Name] = "Context";

            WinMenuItem UiContextMenuItem = new WinMenuItem(UiContextMenu);
            UiContextMenuItem.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
            UiContextMenuItem.SearchProperties[WinMenuItem.PropertyNames.Name] = "Close";

            Mouse.Click(UiContextMenuItem);
            Trace.WriteLine("Clicked Grid Close");
        }
Esempio n. 44
0
        public static void SetItemControlValue(string name, string type, string value, WinWindow parent)
        {
            WinWindow ItemWindow = new WinWindow(parent);
            ItemWindow.SearchProperties.Add("AccessibleName", name);
            ItemWindow.WaitForControlReady();
            WinControl uIControl = new WinControl(ItemWindow);
            uIControl.TechnologyName = "MSAA";
            uIControl.SearchProperties.Add("ControlType", type);
            uIControl.SearchProperties.Add("Name", name);
            uIControl.WaitForControlReady();

            if (type == "CheckBox")
            {
                WinCheckBox mUICheckBox = new WinCheckBox(uIControl);
                mUICheckBox.Checked = Convert.ToBoolean(value);
            }
            else if (type == "Edit")
            {
                WinEdit mUIEdit = new WinEdit(uIControl);
                mUIEdit.Text = value;
            }
        }
        public string GridExport(string GridName, string WhenExported)
        {
            string Fileoutput = String.Empty;
            Trace.WriteLine("Inside GridExport method , waiting");
            System.Threading.Thread.Sleep(5000);
            WinWindow ItemWindow = new WinWindow(GetMainWindow());
            ItemWindow.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32770";
            ItemWindow.SearchProperties[WinWindow.PropertyNames.Instance] = "45";
            ItemWindow.WindowTitles.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString());

            WinControl ItemDialog = new WinControl(ItemWindow);
            ItemDialog.SearchProperties[UITestControl.PropertyNames.ControlType] = "Dialog";
            ItemDialog.WindowTitles.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString());

            WinClient Grid = new WinClient(ItemDialog);
            Grid.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
            Grid.SearchProperties[WinControl.PropertyNames.Name] = "Spread Control (spr32d70)";
            Grid.SearchProperties[WinControl.PropertyNames.ClassName] = "fpSpread70";
            Grid.WindowTitles.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString());

            Grid.DrawHighlight();
            var GridPostion = Grid.BoundingRectangle;
            Point GridClick = new Point(GridPostion.X + 75, GridPostion.Y + 75);
            Mouse.Move(GridClick);
            Trace.WriteLine("Moved mouse to gridclick position");
            Mouse.Click(MouseButtons.Right);
            Trace.WriteLine("Right Clicked on Grid " + GridName);
            System.Threading.Thread.Sleep(1800);

            WinWindow ItemWin2 = new WinWindow();
            ItemWin2.SearchProperties[WinWindow.PropertyNames.AccessibleName] = "Context";
            ItemWin2.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32768";

            WinMenu ContextMenu = new WinMenu(ItemWin2);
            ContextMenu.SearchProperties[WinMenu.PropertyNames.Name] = "Context";

            WinMenuItem ExportItem = new WinMenuItem(ContextMenu);
            ExportItem.SearchProperties[WinMenuItem.PropertyNames.Name] = "Export...";
            Mouse.Hover(ExportItem);
            Mouse.Click(ExportItem);
            Trace.WriteLine("Clicked Export Context Menu Button on grid " + GridName);

            switch (GridName)
            {
                case "BeamWellGroupConfig":
                    {
                        string BeamConfigExportLocation = ExportLocation;
                        string BeamConfigExportFileName = ConfigurationManager.AppSettings["BeamConfigExportFileName"];

                        WinWindow SaveBeamWellConfig = new WinWindow();
                        SaveBeamWellConfig.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains));
                        SaveBeamWellConfig.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32770";
                        SaveBeamWellConfig.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        WinWindow ItemWindowDialog = new WinWindow(SaveBeamWellConfig);
                        ItemWindowDialog.SearchProperties[WinWindow.PropertyNames.ClassName] = "ToolbarWindow32";
                        //ItemWindowDialog.SearchProperties[WinWindow.PropertyNames.Instance] = "4";
                        ItemWindowDialog.WindowTitles.Add((new PropertyExpression(WinToolBar.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        WinToolBar LocationBar = new WinToolBar(ItemWindowDialog);
                        LocationBar.WindowTitles.Add((new PropertyExpression(WinToolBar.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        WinButton PreviousLocation = new WinButton(LocationBar);
                        PreviousLocation.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        PreviousLocation.SearchProperties[WinButton.PropertyNames.Name] = "Previous Locations";
                        PreviousLocation.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        Mouse.Click(PreviousLocation);
                        Trace.WriteLine("Clicked Previous Location on Save Dialog ");

                        WinWindow ItemWin1 = new WinWindow(SaveBeamWellConfig);
                        ItemWin1.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        ItemWin1.SearchProperties.Add(WinWindow.PropertyNames.ControlId, "41477");
                        ItemWin1.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        WinEdit AddressEdit = new WinEdit(ItemWin1);
                        AddressEdit.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        AddressEdit.SearchProperties.Add(WinEdit.PropertyNames.Name, "Address");
                        AddressEdit.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        AddressEdit.Text = BeamConfigExportLocation;
                        Trace.WriteLine("Set export ouput path to " + BeamConfigExportLocation);

                        //Keyboard.SendKeys(BeamConfigExportLocation);
                        Keyboard.SendKeys("{ENTER}");
                        Trace.WriteLine("Set ENTER key");

                        WinPane DPane = new WinPane(SaveBeamWellConfig);
                        DPane.SearchProperties[WinControl.PropertyNames.Name] = "Details Pane";
                        DPane.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        WinComboBox FileName = new WinComboBox(DPane);
                        FileName.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        FileName.SearchProperties.Add(WinComboBox.PropertyNames.Name, "File name:");
                        FileName.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        FileName.EditableItem = BeamConfigExportFileName + WhenExported;
                        Trace.WriteLine("Set FileName of export file to " + BeamConfigExportFileName + WhenExported);
                        WinButton SaveExport = new WinButton(SaveBeamWellConfig);
                        SaveExport.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        SaveExport.SearchProperties.Add(WinButton.PropertyNames.Name, "Save");
                        SaveExport.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Beam Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        Mouse.Click(SaveExport);
                        Trace.WriteLine("Save Export button clicked");
                        Fileoutput = (BeamConfigExportLocation + BeamConfigExportFileName + WhenExported + ".txt");
                        CheckIfExportExists(Fileoutput);

                        break;
                    }
                case "MOP":
                    {
                        string MOPExportLocation = ExportLocation;
                        string MOPExportFileName = ConfigurationManager.AppSettings["MOPExportFileName"];

                        WinWindow SaveMOP = new WinWindow();
                        SaveMOP.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains));
                        SaveMOP.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32770";
                        SaveMOP.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString()));

                        WinWindow ItemWindowDialog = new WinWindow(SaveMOP);
                        ItemWindowDialog.SearchProperties[WinWindow.PropertyNames.ClassName] = "ToolbarWindow32";
                        //ItemWindowDialog.SearchProperties[WinWindow.PropertyNames.Instance] = "4";
                        ItemWindowDialog.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString()));

                        WinToolBar LocationBar = new WinToolBar(ItemWindowDialog);
                        LocationBar.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString()));

                        WinButton PreviousLocation = new WinButton(LocationBar);
                        PreviousLocation.SearchProperties[WinButton.PropertyNames.Name] = "Previous Locations";
                        PreviousLocation.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString()));

                        Mouse.Click(PreviousLocation);
                        Trace.WriteLine("Clicked Previous Location on Save Dialog ");

                        WinWindow ItemWin1 = new WinWindow(SaveMOP);
                        ItemWin1.SearchProperties.Add(WinWindow.PropertyNames.ControlId, "41477");
                        ItemWin1.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString()));

                        WinEdit AddressEdit = new WinEdit(ItemWin1);
                        AddressEdit.SearchProperties.Add(WinEdit.PropertyNames.Name, "Address");
                        AddressEdit.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString()));

                        AddressEdit.Text = MOPExportLocation;
                        Trace.WriteLine("Set export ouput path to " + MOPExportLocation);

                        //Keyboard.SendKeys(BeamConfigExportLocation);
                        Keyboard.SendKeys("{ENTER}");
                        Trace.WriteLine("Set ENTER key");

                        WinPane DPane = new WinPane(SaveMOP);
                        DPane.SearchProperties[WinControl.PropertyNames.Name] = "Details Pane";
                        DPane.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString()));

                        WinComboBox FileName = new WinComboBox(DPane);
                        FileName.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        FileName.SearchProperties.Add(WinComboBox.PropertyNames.Name, "File name:");
                        FileName.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString()));

                        FileName.EditableItem = MOPExportFileName + WhenExported;
                        Trace.WriteLine("Set FileName of export file to " + MOPExportFileName + WhenExported);
                        WinButton SaveExport = new WinButton(SaveMOP);
                        SaveExport.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        SaveExport.SearchProperties.Add(WinButton.PropertyNames.Name, "Save");
                        SaveExport.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save Well Status_MOP_Type History", PropertyExpressionOperator.Contains).ToString()));

                        Mouse.Click(SaveExport);
                        Trace.WriteLine("Save Export button clicked");
                        Fileoutput = (MOPExportLocation + MOPExportFileName + WhenExported + ".txt");
                        CheckIfExportExists(Fileoutput);
                        break;
                    }
                case "ESPGroupConfigGrid":
                    {
                        string ESPGroupConfigGridExportLocation = ExportLocation;
                        string ESPGroupConfigGridExportFileName = ConfigurationManager.AppSettings["ESPConfigExportFileName"];

                        WinWindow SaveESPGroupConfigGrid = new WinWindow();
                        SaveESPGroupConfigGrid.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains));
                        SaveESPGroupConfigGrid.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32770";
                        SaveESPGroupConfigGrid.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        WinWindow ItemWindowDialog = new WinWindow(SaveESPGroupConfigGrid);
                        ItemWindowDialog.SearchProperties[WinWindow.PropertyNames.ClassName] = "ToolbarWindow32";
                        //ItemWindowDialog.SearchProperties[WinWindow.PropertyNames.Instance] = "4";
                        ItemWindowDialog.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        WinToolBar LocationBar = new WinToolBar(ItemWindowDialog);
                        LocationBar.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        WinButton PreviousLocation = new WinButton(LocationBar);
                        PreviousLocation.SearchProperties[WinButton.PropertyNames.Name] = "Previous Locations";
                        PreviousLocation.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        Mouse.Click(PreviousLocation);
                        Trace.WriteLine("Clicked Previous Location on Save Dialog ");

                        WinWindow ItemWin1 = new WinWindow(SaveESPGroupConfigGrid);
                        ItemWin1.SearchProperties.Add(WinWindow.PropertyNames.ControlId, "41477");
                        ItemWin1.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        WinEdit AddressEdit = new WinEdit(ItemWin1);
                        AddressEdit.SearchProperties.Add(WinEdit.PropertyNames.Name, "Address");
                        AddressEdit.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        AddressEdit.Text = ESPGroupConfigGridExportLocation;
                        Trace.WriteLine("Set export ouput path to " + ESPGroupConfigGridExportLocation);

                        //Keyboard.SendKeys(BeamConfigExportLocation);
                        Keyboard.SendKeys("{ENTER}");
                        Trace.WriteLine("Set ENTER key");

                        WinPane DPane = new WinPane(SaveESPGroupConfigGrid);
                        DPane.SearchProperties[WinControl.PropertyNames.Name] = "Details Pane";
                        DPane.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        WinComboBox FileName = new WinComboBox(DPane);
                        FileName.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        FileName.SearchProperties.Add(WinComboBox.PropertyNames.Name, "File name:");
                        FileName.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        FileName.EditableItem = ESPGroupConfigGridExportFileName + WhenExported;
                        Trace.WriteLine("Set FileName of export file to " + ESPGroupConfigGridExportFileName + WhenExported);
                        WinButton SaveExport = new WinButton(SaveESPGroupConfigGrid);
                        SaveExport.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        SaveExport.SearchProperties.Add(WinButton.PropertyNames.Name, "Save");
                        SaveExport.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save ESP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        Mouse.Click(SaveExport);
                        Trace.WriteLine("Save Export button clicked");
                        Fileoutput = (ESPGroupConfigGridExportLocation + ESPGroupConfigGridExportFileName + WhenExported + ".txt");
                        CheckIfExportExists(Fileoutput);
                        break;
                    }
                case "PCPGroupConfigGrid":
                    {
                        string PCPGroupConfigGridExportLocation = ExportLocation;
                        string PCPGroupConfigGridExportFileName = ConfigurationManager.AppSettings["PCPConfigExportFileName"];

                        WinWindow SavePCPGroupConfigGrid = new WinWindow();
                        SavePCPGroupConfigGrid.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains));
                        SavePCPGroupConfigGrid.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32770";
                        SavePCPGroupConfigGrid.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        WinWindow ItemWindowDialog = new WinWindow(SavePCPGroupConfigGrid);
                        ItemWindowDialog.SearchProperties[WinWindow.PropertyNames.ClassName] = "ToolbarWindow32";
                        //ItemWindowDialog.SearchProperties[WinWindow.PropertyNames.Instance] = "4";
                        ItemWindowDialog.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        WinToolBar LocationBar = new WinToolBar(ItemWindowDialog);
                        LocationBar.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        WinButton PreviousLocation = new WinButton(LocationBar);
                        PreviousLocation.SearchProperties[WinButton.PropertyNames.Name] = "Previous Locations";
                        PreviousLocation.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        Mouse.Click(PreviousLocation);
                        Trace.WriteLine("Clicked Previous Location on Save Dialog ");

                        WinWindow ItemWin1 = new WinWindow(SavePCPGroupConfigGrid);
                        ItemWin1.SearchProperties.Add(WinWindow.PropertyNames.ControlId, "41477");
                        ItemWin1.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        WinEdit AddressEdit = new WinEdit(ItemWin1);
                        AddressEdit.SearchProperties.Add(WinEdit.PropertyNames.Name, "Address");
                        AddressEdit.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        AddressEdit.Text = PCPGroupConfigGridExportLocation;
                        Trace.WriteLine("Set export ouput path to " + PCPGroupConfigGridExportLocation);

                        //Keyboard.SendKeys(BeamConfigExportLocation);
                        Keyboard.SendKeys("{ENTER}");
                        Trace.WriteLine("Set ENTER key");

                        WinPane DPane = new WinPane(SavePCPGroupConfigGrid);
                        DPane.SearchProperties[WinControl.PropertyNames.Name] = "Details Pane";
                        DPane.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        WinComboBox FileName = new WinComboBox(DPane);
                        FileName.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        FileName.SearchProperties.Add(WinComboBox.PropertyNames.Name, "File name:");
                        FileName.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        FileName.EditableItem = PCPGroupConfigGridExportFileName + WhenExported;
                        Trace.WriteLine("Set FileName of export file to " + PCPGroupConfigGridExportFileName + WhenExported);
                        WinButton SaveExport = new WinButton(SavePCPGroupConfigGrid);
                        SaveExport.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
                        SaveExport.SearchProperties.Add(WinButton.PropertyNames.Name, "Save");
                        SaveExport.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "Save PCP Well Group Configuration", PropertyExpressionOperator.Contains).ToString()));

                        Mouse.Click(SaveExport);
                        Trace.WriteLine("Save Export button clicked");
                        Fileoutput = (PCPGroupConfigGridExportLocation + PCPGroupConfigGridExportFileName + WhenExported + ".txt");
                        CheckIfExportExists(Fileoutput);
                        break;
                    }
                //PCPGroupConfigGrid
            }

            return Fileoutput;
        }
Esempio n. 46
0
        public static string GetControlValue(string name, string type, WinWindow parent)
        {
            WinControl uIControl = new WinControl(parent);
            uIControl.TechnologyName = "MSAA";
            uIControl.SearchProperties.Add("ControlType", type);
            uIControl.SearchProperties.Add("Name", name);
            uIControl.WaitForControlReady();

            if (type == "CheckBox")
            {
                WinCheckBox mUICheckBox = new WinCheckBox(uIControl);
                return mUICheckBox.Checked.ToString();
            }
            else if (type == "Edit")
            {
                WinEdit mUIEdit = new WinEdit(uIControl);
                return mUIEdit.Text;
            }
            else
            {
                throw new Exception(String.Format("Unknown control. contact automation administrator"));
            }
        }
Esempio n. 47
0
 public static WinControl GetDropDownControl(string name, string type, WinWindow parent)
 {
     WinWindow dropDownWindow = new WinWindow();
     dropDownWindow.SearchProperties[WinWindow.PropertyNames.AccessibleName] = "DropDown";
     dropDownWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains));
     dropDownWindow.WaitForControlReady();
     WinMenu menu = new WinMenu(dropDownWindow);
     menu.SearchProperties[WinMenu.PropertyNames.Name] = "DropDown";
     menu.WaitForControlReady();
     WinControl uIControl = new WinControl(menu);
     uIControl.SearchProperties.Add("ControlType", type);
     uIControl.SearchProperties.Add("Name", name);
     uIControl.WaitForControlReady();
     return uIControl;
 }
        public WinControl GetStartButton()
        {
            WinWindow StartWindow = new WinWindow(GetMainWindow());
            StartWindow.SearchProperties[WinWindow.PropertyNames.ControlId] = "201";
            StartWindow.SearchProperties[WinWindow.PropertyNames.Instance] = "2";
            StartWindow.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));

            WinControl StartButton = new WinControl(StartWindow);
            StartButton.SearchProperties[UITestControl.PropertyNames.Name] = "Start";
            StartButton.SearchProperties[UITestControl.PropertyNames.ControlType] = "Image";
            StartButton.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString()));
            return StartButton;
        }
Esempio n. 49
0
        static void OpenDocument(string filename)
        {
            var window = GetWordWindow();
            var ribbonWindow = GetWordRibbon(window);

            var ribbonControl = new WinControl(ribbonWindow);
            ribbonControl.SearchProperties[UITestControl.PropertyNames.Name] = "Ribbon";
            ribbonControl.SearchProperties[UITestControl.PropertyNames.ControlType] = "PropertyPage";
            ribbonControl.WindowTitles.Add("Document1 - Word");

            var fileButton = new WinButton(ribbonControl);
            fileButton.SearchProperties[WinButton.PropertyNames.Name] = "File Tab";
            fileButton.WindowTitles.Add("Document1 - Word");

            Mouse.Click(fileButton);

            var fileMenu = new WinMenuBar(ribbonWindow);
            fileMenu.SearchProperties[WinMenu.PropertyNames.Name] = "File";
            fileMenu.WindowTitles.Add("Document1 - Word");

            var openTab = new WinTabPage(fileMenu);
            openTab.SearchProperties[WinTabPage.PropertyNames.Name] = "Open";
            openTab.WindowTitles.Add("Document1 - Word");

            Mouse.Click(openTab);

            var itemGroup = new WinGroup(window);
            itemGroup.WindowTitles.Add("Document1 - Word");

            var computerTab = new WinTabPage(itemGroup);
            computerTab.SearchProperties[WinTabPage.PropertyNames.Name] = "Computer";
            Mouse.Click(computerTab);

            var pickaFolderGroup = new WinGroup(window);
            pickaFolderGroup.SearchProperties[WinControl.PropertyNames.Name] = "Pick a Folder";

            var browseButton = new WinButton(pickaFolderGroup);
            browseButton.SearchProperties[WinButton.PropertyNames.Name] = "Browse";
            Mouse.Click(browseButton);

            var openDlg = new WinWindow();
            openDlg.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32770";
            openDlg.WindowTitles.Add("Open");

            var openDlg1 = new WinWindow(openDlg);
            openDlg1.SearchProperties[WinWindow.PropertyNames.ControlId] = "1148";
            openDlg1.WindowTitles.Add("Open");

            var fileNameCombo = new WinComboBox(openDlg1);
            fileNameCombo.SearchProperties[WinComboBox.PropertyNames.Name] = "File name:";
            fileNameCombo.EditableItem = filename;

            var fileNameEdit = new WinEdit(openDlg1);
            fileNameEdit.SearchProperties[WinEdit.PropertyNames.Name] = "File name:";

            Keyboard.SendKeys(fileNameEdit, "{Enter}", ModifierKeys.None);
        }