FindFirst() public method

public FindFirst ( TreeScope scope, Condition condition ) : AutomationElement
scope TreeScope
condition Condition
return AutomationElement
Example #1
0
        private static bool ButtonClick(AutomationElement inElement, string automationId)
        {
            PropertyCondition btnCondition = new PropertyCondition(AutomationElement.AutomationIdProperty, automationId);

            Console.WriteLine("Searching for the {0} button...", automationId);
            AutomationElement control = inElement.FindFirst(TreeScope.Descendants, btnCondition);
            if (control != null)
            {
                Console.WriteLine("Clicking the {0} button", automationId);

                object controlType = control.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty);
                if (controlType == ControlType.Button)
                {
                    InvokePattern clickCommand = control.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern;
                    clickCommand.Invoke();
                }
                else if (controlType == ControlType.RadioButton)
                {
                    SelectionItemPattern radioCheck = control.GetCurrentPattern(SelectionItemPattern.Pattern) as SelectionItemPattern;
                    radioCheck.Select();
                }
                System.Threading.Thread.Sleep(2000);
                Console.WriteLine("Button {0} clicked.", automationId);

                return true;
            }
            else
            {
                Console.WriteLine("Could not find button {0} ", automationId);
                return false;
            }
        }
Example #2
0
        private void InvokeDialogOk(Process process, AutomationElement window, string dialogClass, string okName)
        {
            process.WaitForInputIdle();
            AutomationElement dialog = window.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.ClassNameProperty, dialogClass));
            while(dialog == null)
            {
                Thread.Sleep(16);
                dialog = window.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.ClassNameProperty, dialogClass));
            }
            AutomationElement button = dialog.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, okName));

            object invoke;
            if (button.TryGetCurrentPattern(InvokePattern.Pattern, out invoke))
            {
                ((InvokePattern)invoke).Invoke();
            }
        }
Example #3
0
        public static AutomationElement getAutomationElement(AutomationElement parent, TreeScope scope, ControlType type, string name)
        {
            var element = parent.FindFirst(scope, new AndCondition(
                new PropertyCondition(AutomationElement.ControlTypeProperty, type),
                new PropertyCondition(AutomationElement.NameProperty, name),
                Automation.ControlViewCondition));

            return element;
        }
Example #4
0
        public static AutomationElement FindWindowByName(AutomationElement rootElement, string name, ControlType type)
        {
            PropertyCondition nameCondition = new PropertyCondition(AutomationElement.NameProperty, name);

            PropertyCondition typeCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, type);

            AndCondition andCondition = new AndCondition(nameCondition, typeCondition);

            return rootElement.FindFirst(TreeScope.Element | TreeScope.Descendants, andCondition);
        }
Example #5
0
        public static AutomationElement FindElementById(AutomationElement parentElement, string automationID, ControlType type)
        {
            PropertyCondition typeCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, type);

            PropertyCondition IDCondition = new PropertyCondition(AutomationElement.AutomationIdProperty, automationID);

            AndCondition andCondition = new AndCondition(typeCondition, IDCondition);

            return parentElement.FindFirst(TreeScope.Element | TreeScope.Descendants, andCondition);
        }
        public AutomationElement GetElement(AutomationElement rootElement, AutomationProperty property, object value, TreeScope searchScope)
        {
            AutomationElement aeMainWindow = null;

            int numWaits = 0;
            do
            {
                aeMainWindow = rootElement.FindFirst(searchScope, new PropertyCondition(property, value));
                ++numWaits;
                Thread.Sleep(200);
            } while (aeMainWindow == null && numWaits < 50);
            return aeMainWindow;
        }
Example #7
0
        /// <summary>
        /// Extract Window from parent window
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="titleName"></param>
        /// <returns></returns>
        public static AutomationElement ExtractElement(AutomationElement parent, string nameValue, TreeScope treeScope)
        {
            ValidateArgumentNotNull(parent, "Extract Window from parent window");
            Condition condition = new PropertyCondition(AutomationElement.NameProperty, nameValue);
            AutomationElement appElement;
            DateTime timeOut = DateTime.Now.AddMilliseconds(TimeOutMillSec);
            do
            {
                appElement = parent.FindFirst(treeScope, condition);
            } while (appElement == null && DateTime.Now < timeOut);

            return appElement;
        }
Example #8
0
		public Window(IntPtr hWnd)
			: base(hWnd)
		{
			Angle = 0;
			Scale = 1;
			hasMenu = false;

			Contacts = new WindowContacts(this);

			automationElement = AutomationElement.FromHandle(hWnd);
			PropertyCondition condition = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.MenuBar);
			AutomationElement first = automationElement.FindFirst(TreeScope.Descendants, condition);
			if (first != null && !first.Current.Name.Equals("System Menu Bar"))
				hasMenu = true;
		}
 /// <summary>
 /// This method returns an element searched by its control type from the tree.
 /// </summary>
 /// <param name="root">Root Element of the control</param>
 /// <param name="controlType">Control Type of the element</param>
 /// <returns>Automation Element of teh control</returns>
 public static AutomationElement GetElement(AutomationElement root, ControlType controlType)
 {
     if (root == null)
     {
         throw new ArgumentNullException("root");
     }
     if (controlType == null)
     {
         throw new ArgumentNullException("controlType");
     }
     else
     {
         PropertyCondition condType = new PropertyCondition(AutomationElement.ControlTypeProperty, controlType);
         return root.FindFirst(TreeScope.Descendants, condType);
     }
 }
Example #10
0
        /// <summary>
        /// This method returns an element searched by its name from the tree.
        /// </summary>
        /// <param name="root">Automation Element of the control</param>
        /// <param name="name">Name of the string</param>
        /// <param name="recursive">bool(Recursive - TRUE Or FALSE)</param>
        /// <returns>Automation Element</returns>
        public static AutomationElement GetElement(AutomationElement root, string name, bool recursive)
        {
            if (root == null)
            {
                throw new ArgumentNullException("root");
            }

            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            else
            {
                PropertyCondition condName = new PropertyCondition(AutomationElement.NameProperty, name);
                return root.FindFirst(recursive ? TreeScope.Descendants : TreeScope.Children, condName);
            }
        }
Example #11
0
        public void CompareAutomationElementsTest()
        {
            Process p = BaseTest.StartApplication(@"SampleForm.exe",
                                                  String.Empty);

            try {
                Thread.Sleep(1000);

                SWA.AutomationElement testFormElement = SWA.AutomationElement.RootElement.FindFirst(SWA.TreeScope.Children,
                                                                                                    new SWA.PropertyCondition(AEIds.ProcessIdProperty,
                                                                                                                              p.Id));
                Assert.IsNotNull(testFormElement,
                                 "window");

                SWA.AutomationElement groupBox1Element = testFormElement.FindFirst(SWA.TreeScope.Children,
                                                                                   new SWA.PropertyCondition(AEIds.ControlTypeProperty,
                                                                                                             SWA.ControlType.Group));
                Assert.IsNotNull(groupBox1Element,
                                 "groupBox1");

                Assert.IsTrue(SWA.Automation.Compare(testFormElement, testFormElement),
                              "Identity");

                SWA.AutomationElement testFormElement2 = SWA.AutomationElement.RootElement.FindFirst(SWA.TreeScope.Children,
                                                                                                     new SWA.PropertyCondition(AEIds.ProcessIdProperty,
                                                                                                                               p.Id));

                Assert.IsTrue(SWA.Automation.Compare(testFormElement, testFormElement2),
                              "Comparing different instances representing the same element");

                Assert.IsFalse(SWA.Automation.Compare(testFormElement, groupBox1Element),
                               "Comparing different elements");

                bool argumentNullRaised = false;
                try {
                    SWA.Automation.Compare(testFormElement, null);
                } catch (ArgumentNullException) {
                    argumentNullRaised = true;
                }
                Assert.IsTrue(argumentNullRaised,
                              "Expected ArgumentNullException");
            } finally {
                p.Kill();
            }
        }
        static AutomationElement FindBy(AutomationElement root, int wait, PropertyCondition condition)
        {
            var waitCount = 0;
            AutomationElement node;

            do
            {
                node = root.FindFirst(
                    TreeScope.Descendants,
                    condition);
           
                if(node == null && waitCount <= wait)
                    Thread.Sleep(ImplicitWaitInterval);

                waitCount++;
            } while (node == null && waitCount <= wait);

            return node;
        }
Example #13
0
        public const int TIMEWAIT = 100;                        // Used for starting process

        #endregion

        #region AutomationElementFromCustomId
        // -------------------------------------------------------------------
        // Finds an automation element from a given Automation ID
        // -------------------------------------------------------------------
        static public AutomationElement AutomationElementFromCustomId(AutomationElement element, object identifier, bool verbose)
        {
            Library.ValidateArgumentNonNull(element, "Automation Element");
            Library.ValidateArgumentNonNull(identifier, "Automation ID");

            if (verbose == true)
                /* changing to new flexible logging */
                //Logger.LogComment("Looking for control (" + identifier + ")");
                UIVerifyLogger.LogComment("Looking for control (" + identifier + ")");

            AutomationElement ae;
            ae = element.FindFirst(TreeScope.Children | TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, identifier));
            if (ae == null)
            {
                throw new ArgumentException("Could not identify the element based on the AutomationIdProperty");
            }

            return ae;
        }
Example #14
0
        public static AutomationElement WaitForElementByName(AutomationElement element, int seconds, AutomationElement parent, string name)
        {
            while (element == null)
            {
                Thread.Sleep(1000);

                seconds--;

                element = parent.FindFirst(TreeScope.Descendants,
                 new PropertyCondition(AutomationElement.NameProperty, name));

                if (seconds == 0)
                {
                    throw new NoSuchElementException("Can't find element or it's not loaded!");
                }
            }

            return element;
        }
        internal static AutomationElement FindFirst(
            AutomationElement parent, 
            TreeScope scope, 
            Condition condition, 
            int timeout)
        {
            var dtn = DateTime.Now.AddMilliseconds(timeout);

            // ReSharper disable once LoopVariableIsNeverChangedInsideLoop
            while (DateTime.Now <= dtn)
            {
                var element = parent.FindFirst(scope, condition);
                if (element != null)
                {
                    return element;
                }
            }

            return null;
        }
Example #16
0
 private void InvokeMenuItem(Process process, AutomationElement window, string menu, string menuItem)
 {
     AutomationElement menuElement = window.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, menu));
     object menuExpand;
     if (menuElement.TryGetCurrentPattern(ExpandCollapsePattern.Pattern, out menuExpand))
     {
         ((ExpandCollapsePattern)menuExpand).Expand();
         process.WaitForInputIdle();
         AutomationElement menuItemElement = menuElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, menuItem));
         while (menuItemElement == null)
         {
             Thread.Sleep(16);
             menuItemElement = menuElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, menuItem));
         }
         object menuItemInvoke;
         if (menuItemElement.TryGetCurrentPattern(InvokePattern.Pattern, out menuItemInvoke))
         {
             ((InvokePattern)menuItemInvoke).Invoke();
         }
     }
 }
        public static bool OvertimeWindowApproachingCancel(AutomationElement parent)
        {
            if (parent == null)
                return false;

            var cancel = parent.FindFirst(TreeScope.Descendants,
                new System.Windows.Automation.PropertyCondition(
                    AutomationElement.AutomationIdProperty, "_CancelButton"));

            object pattern;

            if (cancel.TryGetCurrentPattern(InvokePattern.Pattern, out pattern))
            {
                var buttonPattern = pattern as InvokePattern;
                if (buttonPattern != null)
                {
                    buttonPattern.Invoke();
                    return true;
                }
            }

            return false;
        }
Example #18
0
 public TempButton(AutomationElement parent, string automationID)
 {
     _button = parent.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.AutomationIdProperty, automationID));
     Helper.ValidateArgumentNotNull(_button, "Button AutomationElement ");
 }
Example #19
0
        /// -------------------------------------------------------------------
        /// <summary></summary>
        /// -------------------------------------------------------------------
        private void TS_GetMenu(string id, AutomationElement root, out AutomationElement menu, CheckType checkType)
        {
            menu = null;
            if (root == m_le)
            {   // Special case to get past the system menu
                // Get app's menu bar
                if (null != (root = root.FindFirst(TreeScope.Subtree, 
                    new PropertyCondition(AutomationElement.AutomationIdProperty, "MenuBar"))))
                {
                    menu = root.FindFirst(TreeScope.Subtree,
                        new AndCondition(new Condition[]{new PropertyCondition(AutomationElement.AutomationIdProperty, id), 
                                            new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.MenuItem)}));
                }

                if (menu == null)
                    ThrowMe(checkType, "Could not find the menu (" + id + ")");

            }
            
            m_TestStep++;
        }
Example #20
0
        /// -------------------------------------------------------------------
        /// <summary></summary>
        /// -------------------------------------------------------------------
        private void TS_FindDialog(AutomationElement root, out AutomationElement dialogElement, CheckType checkType)
        {
            // "Step: Find the automationelement for the font dialog"
            dialogElement = root.FindFirst(TreeScope.Subtree, new PropertyCondition(AutomationElement.ClassNameProperty, "#32770"));
            if (dialogElement == null)
                ThrowMe(checkType, "Could not find dialog");

            m_TestStep++;
        }
Example #21
0
        /// -------------------------------------------------------------------
        /// <summary></summary>
        /// -------------------------------------------------------------------
        private void TS_ToolTipCurrentlyOpened(AutomationElement parent, ref AutomationElement element, CheckType checkType)
        {
            AutomationElement tip = parent.FindFirst(
                    TreeScope.Children,
                    new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.ToolTip));

            if (tip == null)
                ThrowMe(checkType, "Could not find ToolTip");

            Comment("Found Tooltip[" + Library.GetUISpyLook(tip) + "]");

            element = tip;

            m_TestStep++;
        }
Example #22
0
 //根据NameProperty获取元素对象
 public static AutomationElement FindElementById(AutomationElement appForm,string automationId)
 {
     AutomationElement tarFindElement = appForm.FindFirst(TreeScope.Descendants,new PropertyCondition(AutomationElement.AutomationIdProperty, automationId));
     return tarFindElement;
 }
Example #23
0
        // --------------------------------------------------------------------
        /// <summary>Common helper that gets the AutomationElement based on the 
        /// AutomationId and the TreeScope</summary>
        // --------------------------------------------------------------------
        static AutomationElement GetElementByName(AutomationElement element, TreeScope scope, ControlType controlType, String elementName)
        {
            AutomationElement aeReturn = null;
            if (null == element)
                throw new ElementNotAvailableException("\"element\" is null and does not exist");

            aeReturn = element.FindFirst(scope,
                new AndCondition(
                    new PropertyCondition(AutomationElement.NameProperty, elementName),
                    new PropertyCondition(AutomationElement.ControlTypeProperty, controlType)
                ));
            return aeReturn;
        }
Example #24
0
        /// <summary>
        /// Exract control from parent window by AutomationID
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="automationID"></param>
        /// <returns></returns>
        public static AutomationElement ExtractElementByAutomationID(AutomationElement parent, string automationID)
        {
            ValidateArgumentNotNull(parent, "Extract Control from parent window by Automation ID, parent");
            ValidateArgumentNotNull(parent, "Extract Control from parent window by Automation ID, automation ID");
            Condition condition = new PropertyCondition(AutomationElement.AutomationIdProperty, automationID);
            AutomationElement appElement;
            DateTime timeOut = DateTime.Now.AddMilliseconds(TimeOutMillSec);
            do
            {
                appElement = parent.FindFirst(TreeScope.Descendants, condition);
            } while (appElement == null && DateTime.Now < timeOut);

            return appElement;
        }
Example #25
0
 /// <summary>
 /// Extract Window from parent window by runtime id
 /// </summary>                                            
 /// <param name="parent"></param>
 /// <param name="titleName"></param>
 /// <returns></returns>
 public static AutomationElement ExtractElementByProcessId(AutomationElement parent, int RuntimeID)
 {
     ValidateArgumentNotNull(parent, "Extract Control from parent window by Runtime ID, parent");
     ValidateArgumentNotNull(parent, "Extract Control from parent window by Runtiome ID, Runtime ID");
     Condition condition = new PropertyCondition(AutomationElement.RuntimeIdProperty, RuntimeID);
     AutomationElement appElement = parent.FindFirst(TreeScope.Descendants, condition);
     return appElement;
 }
Example #26
0
 static AutomationElement getAEByName(AutomationElement parent, TreeScope scope, String name)
 {
     return parent.FindFirst(scope, new PropertyCondition(AutomationElement.NameProperty, name));
 }
Example #27
0
        private AutomationElement GetOpenBatchesWindow(AutomationElement mainWindow)
        {
            //return mainWindow.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "Open Batches"));

            return mainWindow.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "Open Batch"));
        }
Example #28
0
 private AutomationElement CaptureListView(AutomationElement openBatchWindow,ref Bitmap bmp)
 {
     var lstView = openBatchWindow.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, ""));
     bmp = CaptureHelper.CaptureControl((IntPtr)lstView.Current.NativeWindowHandle);
     return lstView;
 }
Example #29
0
        // --------------------------------------------------------------------
        /// <summary>Common helper that gets the AutomationElement based on the 
        /// AutomationId and the TreeScope</summary>
        // --------------------------------------------------------------------
        static AutomationElement GetElement(AutomationElement element, TreeScope scope, ControlType controlType, string automationId)
        {
            AutomationElement aeReturn = null;
            if (null == element)
                throw new ElementNotAvailableException("\"element\" is null and does not exist");

            aeReturn = element.FindFirst(scope,
                new AndCondition(new Condition[]
                {
                    new PropertyCondition(AutomationElement.AutomationIdProperty, automationId),
                    new PropertyCondition(AutomationElement.ControlTypeProperty, controlType)
                }));
            return aeReturn;
        }
Example #30
0
 private AutomationElement GetOpenBatchesSelectButton(AutomationElement uiElement)
 {
     return uiElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "Select"));
 }
Example #31
0
        public void DoOperations()
        {
            //Process[] p = Process.GetProcessesByName("mmc");

            //System.Windows.Automation.AutomationElement t = WinFormAdapter.GetAEFromHandle(p[0].MainWindowHandle);
            //System.Windows.Automation.AutomationElement _0 = AutomationElement.FromHandle(p[0].MainWindowHandle);

            //System.Windows.Automation.AutomationElement t1 = WinFormAdapter.GetAEOnChildByName(t, "Sesión A - [24 x 80]");
            //System.Windows.Automation.AutomationElement t1 = t.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "Inicio de sesión de IBM i"));

            //TODO: Obtener por tipo de elemento (Tipo.Edit)
            //Al tener el mismo nombre tanto el label como el textbox de un campo, toma los dos, al parecer el segundo siempre es el textbox....

            Process px = Process.Start(@"C:\Windows\System32\calc.exe");


            AutomationElement aeDesktop = AutomationElement.RootElement;

            Process[] p = Process.GetProcessesByName("calc");

            //System.Windows.Automation.AutomationElement t = WinFormAdapter.GetAEFromHandle(p[0].MainWindowHandle);
            System.Windows.Automation.AutomationElement aeCalculator = AutomationElement.FromHandle(p[0].MainWindowHandle);


            //AutomationElement aeCalculator;



            int numwaits = 0;

            do
            {
                Debug.WriteLine("Looking for Calculator . . . ");
                //aeCalculator = aeDesktop.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "Calculadora"));
                numwaits += 1;
                //Thread.Sleep(100)
            } while (numwaits == null && numwaits < 50);



            String btn5hexID     = "00000087";
            String btn5decimalID = Convert.ToInt32("00000087", 16).ToString();

            String btnAddhexID     = "0000005D";
            String btnAdddecimalID = Convert.ToInt32("0000005D", 16).ToString();

            String btnEqualshexID     = "00000079";
            String btnEqualsdecimalID = Convert.ToInt32("00000079", 16).ToString();

            AutomationElement ae5Btn = aeCalculator.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, btn5decimalID));

            AutomationElement aeAddBtn = aeCalculator.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, btnAdddecimalID));

            AutomationElement aeEqualsBtn = aeCalculator.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, btnEqualsdecimalID));



            InvokePattern ipClick5Btn      = (InvokePattern)ae5Btn.GetCurrentPattern(InvokePattern.Pattern);
            InvokePattern ipClickAddBtn    = (InvokePattern)aeAddBtn.GetCurrentPattern(InvokePattern.Pattern);
            InvokePattern ipClickEqualsBtn = (InvokePattern)aeEqualsBtn.GetCurrentPattern(InvokePattern.Pattern);

            aeCalculator.SetFocus();
            ipClick5Btn.Invoke();
            ipClickAddBtn.Invoke();
            ipClick5Btn.Invoke();
            ipClickEqualsBtn.Invoke();



            /*
             *
             * System.Windows.Automation.AutomationElementCollection x = _0.FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "Servicios (locales)"));
             *
             * System.Windows.Automation.AutomationElementCollection xx = x[0].FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "Web Teller -  Ruteos "));
             * System.Windows.Automation.AutomationElementCollection x2 = _0.FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "Web Teller -  Ruteos "));
             * System.Windows.Automation.AutomationElementCollection x3 = _0.FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "Web Teller -  Ruteos "));
             * System.Windows.Automation.AutomationElementCollection x4 = _0.FindAll(TreeScope.Element, new PropertyCondition(AutomationElement.NameProperty, "Web Teller -  Ruteos "));
             *
             * System.Windows.Automation.AutomationElement y = WinFormAdapter.GetAEOnDescByName(x[0], ControlType.Edit, "Web Teller -  Ruteos ");
             * System.Windows.Automation.AutomationElement y1 = WinFormAdapter.GetAEOnDescByName(xx[0], ControlType.Edit, "Web Teller -  Ruteos ");
             *
             *
             * InvokePattern eee = (InvokePattern)y.GetCurrentPattern(InvokePattern.Pattern);
             * InvokePattern eee2 = (InvokePattern)y1.GetCurrentPattern(InvokePattern.Pattern);
             *
             *
             * eee.Invoke();
             * eee2.Invoke();
             *
             * System.Windows.Automation.AutomationElement y2 = WinFormAdapter.GetAEOnDescByName(xx[1], ControlType.Edit, "Web Teller -  Ruteos ");
             * System.Windows.Automation.AutomationElement y3 = WinFormAdapter.GetAEOnDescByName(xx[2], ControlType.Edit, "Web Teller -  Ruteos ");
             * System.Windows.Automation.AutomationElement y4 = WinFormAdapter.GetAEOnDescByName(x3[0], ControlType.Edit, "Web Teller -  Ruteos ");
             * System.Windows.Automation.AutomationElement y5 = WinFormAdapter.GetAEOnDescByName(x3[1], ControlType.Edit, "Web Teller -  Ruteos ");
             * System.Windows.Automation.AutomationElement y6 = WinFormAdapter.GetAEOnDescByName(x3[2], ControlType.Edit, "Web Teller -  Ruteos ");
             *
             *
             *
             *
             * WinFormAdapter.ClickElement(y);
             * WinFormAdapter.ClickElement(y1);
             *
             * WinFormAdapter.ClickElement(xx[2]);
             * WinFormAdapter.ClickElement(xx[1]);
             * WinFormAdapter.ClickElement(xx[0]);
             *
             */
            //x[0].FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, ""));


            /*System.Windows.Automation.AutomationElementCollection x1 = _0.FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "Servicios (locales)"));
             *
             * System.Windows.Automation.AutomationElementCollection x2 = _0.FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "Área de trabajo"));
             * System.Windows.Automation.AutomationElementCollection x3 = _0.FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "Área de trabajo"));
             */

            /*System.Windows.Automation.AutomationElementCollection _0_Descendants_1 = _0.FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "Servicios"));
             *
             * System.Windows.Automation.AutomationElementCollection _0_Childs_1 = _0.FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "Servicios"));
             *
             *
             * WinFormAdapter.SetText(_0_Descendants_1[1], "BFPJUARUI");
             *
             * System.Windows.Automation.AutomationElementCollection _0_Descendants_2 = _0.FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "Contraseña:"));
             * WinFormAdapter.SetText(_0_Descendants_2[1], "BFPJUARUI2");
             *
             * WinFormAdapter.ClickElement(WinFormAdapter.GetAEOnDescByName(_0, "Aceptar"));*/
        }
 private bool HasCompleted(AutomationElement row) {
     return row.FindFirst(TreeScope.Descendants, new AndCondition(
         new PropertyCondition(AutomationElement.NameProperty, "Completed"),
         new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Text)
     )) != null;
 }
Example #33
0
        private void DoOperations()
        {
            InternetExplorerOptions ieOptions = new InternetExplorerOptions();

            ieOptions.IntroduceInstabilityByIgnoringProtectedModeSettings = true;

            //IWebDriver driverIE = new InternetExplorerDriver(@"D:\COMPARTIDO_PUBLICO\RPA\TCS RPA V1.2 - Training\Sample\Automation - Proceso Cese - JJRDC\Mainframe Automation\Mainframe Automation Solution\packages\Selenium.WebDriver.IEDriver.3.5.1\driver", ieOptions);

            IWebDriver driverIE = new InternetExplorerDriver(System.Configuration.ConfigurationManager.AppSettings["IEDriverPath"], ieOptions);

            //driverIE.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(60);
            driverIE.Navigate().GoToUrl("http://*****:*****@id,'btnAlertaDismiss')]")).Click();
            driverIE.FindElement(By.XPath("//*[contains(@id,'btnAlertaDismiss')]")).Click();

            //acts.SendKeys(Keys.Enter);
            //acts.SendKeys(Keys.Enter);
        }