예제 #1
0
        public virtual UIItemCollection ItemsWithin(Rect bounds, ActionListener actionListener)
        {
            var collection = new UIItemCollection();
            List<AutomationElement> descendants = Finder.Descendants(AutomationSearchCondition.All);
            foreach (AutomationElement automationElement in descendants)
            {
                if (!bounds.Contains(automationElement.Current.BoundingRectangle)) continue;

                var factory = new DictionaryMappedItemFactory();
                collection.Add(factory.Create(automationElement, actionListener));
            }
            return collection;
        }
예제 #2
0
 public virtual UIItemCollection UIItems(ActionListener actionListener)
 {
     if (uiItemCollection != null)
     {
         return(uiItemCollection);
     }
     uiItemCollection = new UIItemCollection();
     foreach (AutomationElement automationElement in list)
     {
         uiItemCollection.Add(dictionaryMappedItemFactory.Create(automationElement, actionListener));
     }
     return(uiItemCollection);
 }
 public void ReviewIUItems(UIItemCollection items)
 {
     foreach (IUIItem x in items)
     {
         Console.WriteLine($"");
         Console.WriteLine($"name {x.Name}");
         Console.WriteLine($"id {x.Id}");
         Console.WriteLine($"prime {x.PrimaryIdentification}");
         Console.WriteLine($"location {x.Location}");
         Console.WriteLine($"bounds {x.Bounds}");
         Console.WriteLine($"type {x.GetType()}");
     }
 }
예제 #4
0
        public void TestMethod1()
        {
            Application app    = base.Application;
            Window      window = app.GetWindow(SearchCriteria.ByAutomationId("StartScreen"), InitializeOption.WithCache);

            Add_Level_Data();
            window.WaitWhileBusy();
            //click the cont button
            Button contBtn = window.Get <Button>(SearchCriteria.ByAutomationId("button2"));

            contBtn.Click();

            // get cont window
            Window cont = app.GetWindow(SearchCriteria.ByAutomationId("ContinueGame"), InitializeOption.WithCache);

            cont.WaitWhileBusy();

            IUIItem[] children1 = cont.GetMultiple(SearchCriteria.All);
            //get lvl 3 button
            Button lvl3Btn = (Button)children1[3];

            lvl3Btn.Click();
            // get game window
            Window           game  = app.GetWindow(SearchCriteria.ByAutomationId("Form3"), InitializeOption.WithCache);
            UIItemCollection items = game.Items;


            // put stuff here to win



            Window win = app.GetWindow(SearchCriteria.ByAutomationId("LevelComplete3"), InitializeOption.WithCache);

            win.WaitWhileBusy();
            children1 = win.GetMultiple(SearchCriteria.All); //4-save 5-quit

            Button saveBtn = (Button)children1[4];

            saveBtn.Click();
            win.WaitWhileBusy();

            Button quitBtn = (Button)children1[5];

            quitBtn.Click();

            app.Close();
            app.Dispose();
        }
예제 #5
0
        public virtual UIItemCollection ItemsWithin(Rect bounds, ActionListener actionListener)
        {
            var collection = new UIItemCollection();
            List <AutomationElement> descendants = finder.Descendants(AutomationSearchCondition.All);

            foreach (AutomationElement automationElement in descendants)
            {
                if (!bounds.Contains(automationElement.Current.BoundingRectangle))
                {
                    continue;
                }

                var factory = new DictionaryMappedItemFactory();
                collection.Add(factory.Create(automationElement, actionListener));
            }
            return(collection);
        }
        private static int FindPromptIndex(UIItemCollection controls, int startingIndex)
        {
            int promptIndex = startingIndex;

            while (promptIndex >= 0)
            {
                WPFLabel textBlock = controls[promptIndex] as WPFLabel;

                if (textBlock != null && (textBlock.Text == DefaultPrompt || textBlock.Text == DbgPrompt || textBlock.Text == ExecutingPrompt))
                {
                    break;
                }

                promptIndex--;
            }

            return(promptIndex);
        }
예제 #7
0
        //If it's allready open -> returns true. If it's closed it tries opens it.
        public static void openPianoRollContextMenu(IntPtr windowHandle, TestStack.White.UIItems.WindowItems.Window window)
        {
            TestStack.White.UIItems.Panel itemToClick = null;

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

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

            if (focus)
            {
                var   mouse = window.Mouse;
                Point p     = itemToClick.Location;
                p.Offset(11, 12);
                mouse.Click(p);
            }
            else
            {
                //Do it as well, but log it
                Debug.Print("Failed to focus window");
                var   mouse = window.Mouse;
                Point p     = itemToClick.Location;
                p.Offset(11, 12);
                mouse.Click(p);
            }
            //}
        }
예제 #8
0
        //**************************************************************************************************************************************************************
        public static void HighLightAndShowProperties(UIItemCollection item, String elementType)
        {
            String spy = null;

            try
            {
                foreach (var element in item)
                {
                    if (element.GetType().Name.Contains(elementType) || element.GetType().Name.Equals(elementType))
                    {
                        element.RightClick();
                        var name = element.Name;
                        var id = element.Id;
                        var pid = element.PrimaryIdentification;
                        MessageBox.Show(" Name= " + name + " ID= " + id + " PrimaryID= " + pid + " / ");
                        AutomationProperty[] properties = element.AutomationElement.GetSupportedProperties();
                        foreach (var p in properties)
                        {
                            try
                            {

                                var value = element.AutomationElement.GetCurrentPropertyValue(p);
                                var property = p.ProgrammaticName;
                                spy = spy + " -- " + value + " / " + property;
                            }
                            catch (Exception e)
                            {
                                var err = e.Message;
                            }
                        }
                        MessageBox.Show(spy.ToString());
                        spy = null;
                    }
                }
            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #9
0
 //**************************************************************************************************************************************************************
 public static void HighLightWindowElements(UIItemCollection collection)
 {
     try
     {
         foreach (IUIItem item in collection)
         {
                 try
                 {
                     item.RightClick();
                     Thread.Sleep(int.Parse(Execution_Speed));
                 }
                 catch (Exception)
                 {
                 }
         }
     }
     catch (Exception e)
     {
         String sMessage = e.Message;
         LastException.SetLastError(sMessage);
         throw new Exception(sMessage);
     }
 }
예제 #10
0
        //**************************************************************************************************************************************************************
        public static List<IUIItem> GetAllListItems(UIItemCollection collection)
        {
            List<IUIItem> listItems = new List<IUIItem>();

            try
            {
                foreach (IUIItem element in collection)
                {
                    if (element.GetType().Name.Contains("List") || element.GetType().Equals("List"))
                    {
                        listItems.Add(element);
                    }
                }

                return listItems;
            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #11
0
        //**************************************************************************************************************************************************************
        public static List<IUIItem> GetAllTextBoxes(UIItemCollection collection)
        {
            List<IUIItem> textBoxes = new List<IUIItem>();

            try
            {
                foreach (IUIItem element in collection)
                {
                    if (element.GetType().Name.Contains("Text") || element.GetType().Equals("Text"))
                    {
                        TestStack.White.UIItems.TextBox x = (TestStack.White.UIItems.TextBox) element;
                        textBoxes.Add(x);
                    }
                }

                return textBoxes;
            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #12
0
        //**************************************************************************************************************************************************************
        public static void FileOutAutomationIDs(UIItemCollection collection, String fileName)
        {
            try
            {
                FileInfo test = new FileInfo(@fileName);
                string temp = string.Empty;

                using (System.IO.StreamWriter file = new System.IO.StreamWriter(@fileName))
                {
                    foreach (IUIItem item in collection)
                    {
                        try
                        {
                            AutomationProperty p = AutomationElementIdentifiers.NameProperty;
                            var element = item.AutomationElement.ToString();
                            var value = item.AutomationElement.GetCurrentPropertyValue(p).ToString();
                            temp = element + " / " + item.GetType().ToString() + " = " + value;
                            file.WriteLine(temp);
                            test.AppendText().WriteLine(temp);
                            test.AppendText().Flush();
                        }
                        catch (Exception)
                        {
                        }
                    }
                }

                System.IO.File.WriteAllText(@fileName, temp);

            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #13
0
        //**************************************************************************************************************************************************************
        public static List<IUIItem> GetAllCustomControls(UIItemCollection collection)
        {
            List<IUIItem> customControls = new List<IUIItem>();

            try
            {
                foreach (IUIItem element in collection)
                {
                    if (element.GetType().Name.Contains("Custom") || element.GetType().Equals("Custom"))
                    {
                        var x = (TestStack.White.UIItems.Custom.CustomUIItem)element;
                        customControls.Add(x);
                    }
                }

                return customControls;
            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
 public void PostToDatePicker(UIItemCollection items, Dictionary <string, string> valueDictionary, Window window)
 {
     UpdateDatePickersFromDictionary(valueDictionary, CreateDatePickerDictionary(items), window);
 }
예제 #15
0
        //**************************************************************************************************************************************************************

        public static TestStack.White.UIItems.Panel GetPanelElementByName(UIItemCollection collection, string elementName)
        {
            Logger.logMessage("Function call @ :" + DateTime.Now);

            TestStack.White.UIItems.Panel p = null;

            try
            {
                foreach (IUIItem element in collection)
                {
                    if (element.GetType().Name.Contains("Pane") && element.Name.Equals(elementName))
                    {
                        p = (TestStack.White.UIItems.Panel)element;
                        break;
                    }
                }
                Logger.logMessage("GetPanelElementByName " + collection + "->" + elementName + " - Successful");
                Logger.logMessage("------------------------------------------------------------------------------");

                return p;
            }
            catch (Exception e)
            {
                Logger.logMessage("GetPanelElementByName " + collection + "->" + elementName + " - Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }

        }
예제 #16
0
        public void ItemsReturnsCustomUIItemToo()
        {
            UIItemCollection uiItemCollection = window.Items;

            Assert.AreEqual(true, uiItemCollection.Any(item => item is MyDateUIItem));
        }
 public void PostToComboBoxes(UIItemCollection items, Dictionary <string, string> valueDictionary)
 {
     UpdateComboBoxesFromDictionary(valueDictionary, CreateComboBoxDictionary(items));
 }
예제 #18
0
        //**************************************************************************************************************************************************************

        public static List<IUIItem> GetAllButtons(UIItemCollection collection)
        {
            Logger.logMessage("Function call @ :" + DateTime.Now);

            List<IUIItem> buttons = new List<IUIItem>();

            try
            {
                foreach (IUIItem element in collection)
                {
                    if (element.GetType().Name.Contains("Button") || element.GetType().Equals("Button"))
                    {
                        TestStack.White.UIItems.Button x = (TestStack.White.UIItems.Button)element;
                        buttons.Add(x);
                    }
                }
                Logger.logMessage("GetAllButtons " + collection + " - Successful");
                Logger.logMessage("------------------------------------------------------------------------------");
                return buttons;
            }
            catch (Exception e)
            {
                Logger.logMessage("GetAllButtons " + collection + " - Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }

        }
예제 #19
0
        //**************************************************************************************************************************************************************

        public static void ClickWPFButton(Window win, UIItemCollection collection, String text)
        {
            Logger.logMessage("Function call @ :" + DateTime.Now);

            try
            {
                foreach (var item in collection)
                {
                    if (item.GetType().Name.Equals("WPFButton"))
                    {
                        AutomationProperty[] properties = item.AutomationElement.GetSupportedProperties();
                        foreach (AutomationProperty p in properties)
                        {
                            if (item.AutomationElement.GetCurrentPropertyValue(p).Equals(text))
                            {
                                item.Click();
                                Thread.Sleep(int.Parse(Execution_Speed));
                                break;
                            }
                        }
                    }
                    Logger.logMessage("ClickWPFButton " + win + "->" + collection + "->" + text + " - Successful");
                    Logger.logMessage("------------------------------------------------------------------------------");
                    Thread.Sleep(int.Parse(Execution_Speed));
                }
            }
            catch (Exception e)
            {
                Logger.logMessage("ClickWPFButton " + collection + "->" + text + " - Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #20
0
        //**************************************************************************************************************************************************************

        public static void HighLightWindowElements(UIItemCollection collection)
        {
            Logger.logMessage("Function call @ :" + DateTime.Now);
            try
            {
                foreach (IUIItem item in collection)
                {
                    try
                    {
                        item.RightClick();
                        Thread.Sleep(int.Parse(Execution_Speed));
                    }
                    catch (Exception)
                    {
                    }
                }
                Logger.logMessage("HighLightWindowElements " + collection + " - Successful");
                Logger.logMessage("------------------------------------------------------------------------------");

            }
            catch (Exception e)
            {
                Logger.logMessage("HighLightWindowElements " + collection + " - Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #21
0
 public virtual IUIItem Filter(UIItemCollection collection)
 {
     var list = new List<IUIItem>(collection);
     list.Sort(new UIItemPositionComparer());
     return list.Count < (index + 1) ? null : list[index];
 }
예제 #22
0
 //**************************************************************************************************************************************************************
 public static void ClickWPFButton(Window win, UIItemCollection collection, String text)
 {
     try
     {
         foreach (var item in collection)
         {
             if (item.GetType().Name.Equals("WPFButton"))
             {
                 AutomationProperty[] properties = item.AutomationElement.GetSupportedProperties();
                 foreach (AutomationProperty p in properties)
                 {
                     if (item.AutomationElement.GetCurrentPropertyValue(p).Equals(text))
                     {
                         item.Click();
                         Thread.Sleep(int.Parse(Execution_Speed));
                         break;
                     }
                 }
             }
             Thread.Sleep(500);
         }
     }
     catch (Exception e)
     {
         String sMessage = e.Message;
         LastException.SetLastError(sMessage);
         throw new Exception(sMessage);
     }
 }
예제 #23
0
        //**************************************************************************************************************************************************************

        public static List<IUIItem> GetAllCustomControls(UIItemCollection collection)
        {
            Logger.logMessage("Function call @ :" + DateTime.Now);

            List<IUIItem> customControls = new List<IUIItem>();

            try
            {
                foreach (IUIItem element in collection)
                {
                    if (element.GetType().Name.Contains("Custom") || element.GetType().Equals("Custom"))
                    {
                        var x = (TestStack.White.UIItems.Custom.CustomUIItem)element;
                        customControls.Add(x);
                    }
                }
                Logger.logMessage("GetAllCustomControls " + collection + " - Successful");
                Logger.logMessage("------------------------------------------------------------------------------");

                return customControls;
            }
            catch (Exception e)
            {
                Logger.logMessage("GetAllCustomControls " + collection + " - Successful");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }

        }
예제 #24
0
        //**************************************************************************************************************************************************************

        public static List<IUIItem> GetAllListItems(UIItemCollection collection)
        {
            Logger.logMessage("Function call @ :" + DateTime.Now);
            List<IUIItem> listItems = new List<IUIItem>();

            try
            {
                foreach (IUIItem element in collection)
                {
                    if (element.GetType().Name.Contains("List") || element.GetType().Equals("List"))
                    {
                        listItems.Add(element);
                    }
                }
                Logger.logMessage("GetAllListItems " + collection + " - Successful");
                Logger.logMessage("------------------------------------------------------------------------------");

                return listItems;
            }
            catch (Exception e)
            {
                Logger.logMessage("GetAllListItems " + collection + " - Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }

        }
        public void TestMethod1()
        {
            TestStack.White.Application app = base.Application;
            Window window = app.GetWindow(SearchCriteria.ByAutomationId("StartScreen"), InitializeOption.WithCache);

            Delete_LevelData();
            window.WaitWhileBusy();
            //click the cont button
            Button contBtn = window.Get <Button>(SearchCriteria.ByAutomationId("button2"));

            contBtn.Click();

            // get cont window
            Window cont = app.GetWindow(SearchCriteria.ByAutomationId("ContinueGame"), InitializeOption.WithCache);

            cont.WaitWhileBusy();

            IUIItem[] children1 = cont.GetMultiple(SearchCriteria.All);
            //get lvl 1 button
            Button lvl1Btn = (Button)children1[1];

            lvl1Btn.Click();
            // get game window
            Window game = app.GetWindow(SearchCriteria.ByAutomationId("Form1"), InitializeOption.NoCache);

            game.Focus();

            UIItemCollection items = game.Items;

            items[24].Focus();

            SendKeys.Send("{SPACE}");



            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RIGHT);//winElem14.SendKeys(Keys.Right);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SPACE);//winElem14.SendKeys(Keys.Space);
            //input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.LEFT);//winElem14.SendKeys(Keys.Left);


            Window win = app.GetWindow(SearchCriteria.ByAutomationId("LevelComplete"), InitializeOption.WithCache);

            win.WaitWhileBusy();
            children1 = win.GetMultiple(SearchCriteria.All); //35

            Button saveBtn = (Button)children1[4];

            saveBtn.Click();
            win.WaitWhileBusy();

            Button quitBtn = (Button)children1[5];

            quitBtn.Click();

            app.Close();
            app.Dispose();
        }
예제 #26
0
 public virtual IUIItem IndexedItem(UIItemCollection collection)
 {
     return indexCondition.Filter(collection);
 }
예제 #27
0
 public virtual IUIItem IndexedItem(UIItemCollection collection)
 {
     return(indexCondition.Filter(collection));
 }
예제 #28
0
 //**************************************************************************************************************************************************************
 public static bool ClickButtonByOrientation(UIItemCollection item, String identifier)
 {
     AutomationProperty p = AutomationElementIdentifiers.OrientationProperty;
     try
     {
         foreach (IUIItem element in item)
         {
             if (element.GetType().Name.Contains("Button") || element.GetType().Name.Equals("Button"))
             {
                 if (element.Name.Equals(identifier) || element.Id.Equals(identifier) || element.PrimaryIdentification.Equals(identifier))
                 {
                     element.Click();
                     Thread.Sleep(int.Parse(Execution_Speed));
                     return true;
                 }
             }
         }
         return false;
     }
     catch (Exception e)
     {
         String sMessage = e.Message;
         LastException.SetLastError(sMessage);
         throw new Exception(sMessage);
     }
 }