// Invokes click on next button
        private void ClickNextButton(UIItemContainer wizard)
        {
            var finish = wizard.Get <Button>(
                SearchCriteria.ByText(_resourceHelper.GetWizardFrameworkResourceString("ButtonNextText")));

            finish.Click();
        }
示例#2
0
        public static UIItem GetCollapsibleRegionHeader(this UIItemContainer rootElement, string controlId)
        {
            Tab    tab          = rootElement.Get <Tab>(TestDataInfrastructure.GetControlId("CollapsibleRegion"));
            UIItem watchListTab = tab.Pages.Find(x => x.NameMatches(TestDataInfrastructure.GetControlId(controlId))) as UIItem;

            return(watchListTab);
        }
        // Handles the new connection dialog
        private void HandleConnectionDialog(UIItemContainer wizard, string dbName)
        {
            var serverNameText = wizard.Get <TextBox>(
                SearchCriteria.ByText(
                    _resourceHelper.GetConnectionUIDialogResourceString("serverLabel.Text")));

            serverNameText.Enter(@"(localdb)\v11.0");

            var refreshButton = wizard.Get <Button>(
                SearchCriteria.ByText(
                    _resourceHelper.GetConnectionUIDialogResourceString("refreshButton.Text")));

            refreshButton.Focus();

            var dbNameText = wizard.Get <TextBox>(
                SearchCriteria.ByText(
                    _resourceHelper.GetConnectionUIDialogResourceString("selectDatabaseRadioButton.Text")));

            dbNameText.Enter(dbName);

            var okButton = wizard.Get <Button>(
                SearchCriteria.ByText(
                    _resourceHelper.GetConnectionUIDialogResourceString("acceptButton.Text")));

            okButton.Click();
        }
示例#4
0
 public virtual void CustomWait(UIItemContainer uiItemContainer)
 {
     if (CoreAppXmlConfiguration.Instance.AdditionalWaitHook != null)
     {
         CoreAppXmlConfiguration.Instance.AdditionalWaitHook.WaitFor(uiItemContainer);
     }
 }
示例#5
0
 public static IReadOnlyList <T> GetMultiple <T>(this UIItemContainer container, string automationId)
     where T : IUIItem
 {
     return(container.GetMultiple(SearchCriteria.ByAutomationId(automationId))
            .OfType <T>()
            .ToList());
 }
示例#6
0
        public static T GetSibling <T>(this IUIItem childElement, SearchCriteria searchCriteria) where T : IUIItem
        {
            var element         = childElement.GetParent <IUIItem>();
            var parentContainer = new UIItemContainer(element.AutomationElement, element.ActionListener);

            return((T)parentContainer.Get(searchCriteria));
        }
示例#7
0
 public virtual void CustomWait(UIItemContainer uiItemContainer)
 {
     if (CoreAppXmlConfiguration.Instance.AdditionalWaitHook != null)
     {
         CoreAppXmlConfiguration.Instance.AdditionalWaitHook.WaitFor(uiItemContainer);
     }
 }
示例#8
0
 public static T GetByNameOrDefault <T>(this UIItemContainer itemContainer, string name, params string[] alternativeNames)
     where T : IUIItem
 {
     return(itemContainer.Items.OfType <T>()
            .FirstOrDefault(p => p.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase) ||
                            alternativeNames.Any(an => an.Equals(p.Name, StringComparison.InvariantCultureIgnoreCase))));
 }
 public static MenuBar menu(this UIItemContainer container)
 {
     if (container.notNull())
     {
         return(container.MenuBar);
     }
     return(null);
 }
        public SettingsWindow Settings()
        {
            WhiteWindow.Get<Button>("MarkpadSettings").Click();
            var automationElement = WhiteWindow.GetElement(SearchCriteria.ByAutomationId("SettingsControl"));
            var settingsControl = new UIItemContainer(automationElement, new ProcessActionListener(automationElement));

            return new SettingsWindow(Application, WhiteWindow, settingsControl);
        }
示例#11
0
        public SettingsWindow Settings()
        {
            WhiteWindow.Get <Button>("MarkpadSettings").Click();
            var automationElement = WhiteWindow.GetElement(SearchCriteria.ByAutomationId("SettingsControl"));
            var settingsControl   = new UIItemContainer(automationElement, new ProcessActionListener(automationElement));

            return(new SettingsWindow(Application, WhiteWindow, settingsControl));
        }
 //Button
 public static Button button(this UIItemContainer container, string text)
 {
     if (container.notNull())
     {
         return(container.get <Button>(text));
     }
     return(null);
 }
 //Link
 public static Hyperlink link(this UIItemContainer container, string text)
 {
     if (container.notNull())
     {
         return(container.get <Hyperlink>(text));
     }
     return(null);
 }
 //TreeView
 public static Tree treeView(this UIItemContainer container)
 {
     if (container.notNull())
     {
         return(container.Get <Tree>());
     }
     return(null);
 }
        //PropertyGrid
        public static PropertyGrid propertyGrid(this UIItemContainer container)
        {
            var propertyGrids = container.items <PropertyGrid>();

            if (propertyGrids.notNull() && propertyGrids.size() > 0)
            {
                return(propertyGrids[0]);
            }
            return(null);
        }
 //TabPages
 public static List <ITabPage> tabPages(this UIItemContainer container)
 {
     if (container.isNull())
     {
         return(null);
     }
     return((from tab in container.Tabs
             from tabPage in tab.Pages
             select tabPage).toList());
 }
示例#17
0
 public void DeclareThis <T>(string element, T UIobject)
     where T : UIObject
 {
     switch (element)
     {
     case "UIItemContainer":
         itemContainerUI = UIobject as UIItemContainer;
         break;
     }
 }
        /// <summary>
        ///     Chooses 'Create Empty Model' option for the wizard and clicks finish button
        /// </summary>
        private void CreateEmptyModel(UIItemContainer wizard)
        {
            // Select the empty model option
            SelectModelOption(
                wizard,
                _resourceHelper.GetEntityDesignResourceString("EmptyModelOption"));

            var finish = wizard.Get <Button>(SearchCriteria.ByText(_resourceHelper.GetWizardFrameworkResourceString("ButtonFinishText")));

            finish.Click();
        }
        private void SelectModelOption(UIItemContainer wizard, string modelOption)
        {
            Trace.WriteLine(DateTime.Now.ToLongTimeString() + ":SelectModelOption");
            Trace.WriteLine(DateTime.Now.ToLongTimeString() + ":trying to find option list");

            var options =
                wizard.Get <ListBox>(SearchCriteria.ByText(_resourceHelper.GetEntityDesignResourceString("StartPage_PromptLabelText")));
            var item = options.Item(modelOption);

            item.Select();
        }
        /*public static Label text(this Label label, string text)
         * {
         *      return label.set_Text(text);
         * }
         *
         * public static Label set_Text(this Label label, string text)
         * {
         *      label.Text = text;
         *      return label;
         * }*/

        //TextBox
        public static TextBox textBox(this UIItemContainer container, int automationId)
        {
            foreach (var textBox in container.textBoxes())
            {
                if (textBox.Id == automationId.str())
                {
                    return(textBox);
                }
            }
            return(null);
        }
 public static ITabPage tabPage(this UIItemContainer container, string name)
 {
     foreach (var tabPage in container.tabPages())
     {
         if (tabPage.Name == name)
         {
             return(tabPage);
         }
     }
     return(null);
 }
        //Panels

        public static Panel panel(this UIItemContainer container, string name)
        {
            foreach (var panel in container.panels())
            {
                if (panel.Name == name)
                {
                    return(panel);
                }
            }
            return(null);
        }
 public static Tree treeView(this UIItemContainer container, string name)
 {
     foreach (var treeView in container.treeViews())
     {
         if (treeView.Name == name)
         {
             return(treeView);
         }
     }
     return(null);
 }
 public static List <T> items <T>(this UIItemContainer container)
     where T : IUIItem
 {
     if (container.notNull())
     {
         return((from item in container.Items
                 where item is T
                 select(T) item).toList());
     }
     return(new List <T>());
 }
示例#25
0
        /// <summary>
        /// Manually searches for a <see cref="UIItem"/> in a container.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="automationId">The automation ID for the control.</param>
        /// <param name="log">The log object.</param>
        /// <returns>The control if it can be found; otherwise, <see langword="null" />.</returns>
        public static IUIItem FindItemManuallyInUIContainer(UIItemContainer container, string automationId, Log log)
        {
            const string logPrefix = "Controls - Find element manually";

            log.Debug(
                logPrefix,
                string.Format(
                    CultureInfo.InvariantCulture,
                    "Searching for UI element with ID: [{0}].",
                    automationId));

            if ((container == null) || string.IsNullOrEmpty(automationId))
            {
                return(null);
            }

            var stack = new Stack <UIItemContainer>();

            stack.Push(container);
            while (stack.Count > 0)
            {
                var localContainer = stack.Pop();
                foreach (var element in localContainer.Items)
                {
                    log.Debug(
                        logPrefix,
                        string.Format(
                            CultureInfo.InvariantCulture,
                            "Found UI item of type [{0}] with ID: [{1}]. Name: [{2}]",
                            element.GetType().Name,
                            element.Id,
                            element.Name));
                    if (string.Equals(element.Id, automationId, StringComparison.Ordinal))
                    {
                        log.Info(
                            logPrefix,
                            string.Format(
                                CultureInfo.InvariantCulture,
                                "Found desired element of type [{0}] with ID: [{1}]",
                                element.GetType().Name,
                                element.Id));
                        return(element);
                    }

                    var subContainer = element as UIItemContainer;
                    if (subContainer != null)
                    {
                        stack.Push(subContainer);
                    }
                }
            }

            return(null);
        }
        // checks all the checkboxes on the "which database objects to select" dialog
        private static void CheckAllCheckBoxes(UIItemContainer wizard)
        {
            var pane = wizard.Get <Panel>(SearchCriteria.ByAutomationId("treeView"));
            var tree = pane.Get <Tree>(SearchCriteria.ByControlType(ControlType.Tree));

            Assert.IsTrue(tree.Nodes.Count != 0);
            foreach (var checkbox in tree.Nodes)
            {
                checkbox.Click();
                Keyboard.Instance.Enter(" ");
            }
        }
示例#27
0
        public static bool TryGet <T>(this UIItemContainer lookHere,
                                      SearchCriteria criteria, out T matchingItem) where T : IUIItem
        {
            if (lookHere.Exists <T>(criteria))
            {
                matchingItem = lookHere.Get <T>(criteria);
                return(true);
            }

            matchingItem = default(T);
            return(false);
        }
示例#28
0
        public static List <T> GetChildren <T>(this IUIItem parent, SearchCriteria searchCriteria) where T : IUIItem
        {
            var resultingList   = new List <T>();
            var parentContainer = new UIItemContainer(parent.AutomationElement, parent.ActionListener);
            var items           = parentContainer.GetMultiple(searchCriteria);

            foreach (var item in items)
            {
                resultingList.Add((T)item);
            }
            return(resultingList);
        }
示例#29
0
        /// <summary>
        /// Manually searches for a <see cref="UIItem"/> in a container.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="automationId">The automation ID for the control.</param>
        /// <param name="log">The log object.</param>
        /// <returns>The control if it can be found; otherwise, <see langword="null" />.</returns>
        public static IUIItem FindItemManuallyInUIContainer(UIItemContainer container, string automationId, Log log)
        {
            const string logPrefix = "Controls - Find element manually";
            log.Debug(
                logPrefix,
                string.Format(
                    CultureInfo.InvariantCulture,
                    "Searching for UI element with ID: [{0}].",
                    automationId));

            if ((container == null) || string.IsNullOrEmpty(automationId))
            {
                return null;
            }

            var stack = new Stack<UIItemContainer>();
            stack.Push(container);
            while (stack.Count > 0)
            {
                var localContainer = stack.Pop();
                foreach (var element in localContainer.Items)
                {
                    log.Debug(
                        logPrefix,
                        string.Format(
                            CultureInfo.InvariantCulture,
                            "Found UI item of type [{0}] with ID: [{1}]. Name: [{2}]",
                            element.GetType().Name,
                            element.Id,
                            element.Name));
                    if (string.Equals(element.Id, automationId, StringComparison.Ordinal))
                    {
                        log.Info(
                            logPrefix,
                            string.Format(
                                CultureInfo.InvariantCulture,
                                "Found desired element of type [{0}] with ID: [{1}]",
                                element.GetType().Name,
                                element.Id));
                        return element;
                    }

                    var subContainer = element as UIItemContainer;
                    if (subContainer != null)
                    {
                        stack.Push(subContainer);
                    }
                }
            }

            return null;
        }
示例#30
0
    private void Awake()
    {
        parent = GetComponentInParent <UIItemContainer>();
        text   = GetComponent <Text>();
        image  = GetComponent <Image>();
        index  = transform.parent.GetSiblingIndex() - 1;

        if (parent)
        {
            bool index_bool = (index == 0) ? true : false;
            //parent.DeclareThis(Label, this, index_bool);
        }
    }
        internal static void SetWindowForm(SearchCriteria sc)
        {
            if (windows == null)
            {
                windows = new Stack <Window>();
                windows.Push(app.GetWindow(sc, InitializeOption.NoCache));
            }
            else
            {
                windows.Push(currentWindow.ModalWindow(sc));
            }

            currentForm = currentWindow;
        }
示例#32
0
        public UIItemContainer GetMdiWindowByAutomationId(string id)
        {
            UIItemContainer container = null;

            WaitHandler.WaitUntil(() =>
            {
                try
                {
                    var ele   = window.GetElement(SearchCriteria.ByAutomationId(id));
                    container = new UIItemContainer(ele, HuxleyApplication.MainForm.window.ActionListener);
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }, "cannot find element ");
            return(container);
        }
示例#33
0
        /// <summary>
        /// method to Perform Addition of two numbers and validate the result
        /// </summary>
        private static void PerformSummationOnCalculator(UIItemContainer mainWindow)
        {
            mainWindow.Get<Button>(SearchCriteria.ByText("1")).Click();
            mainWindow.Get<Button>(SearchCriteria.ByText("2")).Click();
            mainWindow.Get<Button>(SearchCriteria.ByText("3")).Click();
            mainWindow.Get<Button>(SearchCriteria.ByText("4")).Click();
            mainWindow.Get<Button>(SearchCriteria.ByText("Add")).Click();
            mainWindow.Get<Button>(SearchCriteria.ByText("5")).Click();
            mainWindow.Get<Button>(SearchCriteria.ByText("6")).Click();
            mainWindow.Get<Button>(SearchCriteria.ByText("7")).Click();
            mainWindow.Get<Button>(SearchCriteria.ByText("8")).Click();
            //Button with text as +(for sum)
            //Read button to get the result
            mainWindow.Get<Button>(SearchCriteria.ByText("Equals")).Click();

            //Get the result
            var resultLable = mainWindow.Get<Label>(SearchCriteria.ByAutomationId("150"));
            string result = resultLable.Text;
            Assert.AreEqual("6912", result);
        }
示例#34
0
        /// <summary>
        /// method to Perform Addition of two numbers and validate the result
        /// </summary>
        private static void PerformSummationOnCalculator(UIItemContainer mainWindow)
        {
            mainWindow.Get <Button>(SearchCriteria.ByText("1")).Click();
            mainWindow.Get <Button>(SearchCriteria.ByText("2")).Click();
            mainWindow.Get <Button>(SearchCriteria.ByText("3")).Click();
            mainWindow.Get <Button>(SearchCriteria.ByText("4")).Click();
            mainWindow.Get <Button>(SearchCriteria.ByText("Add")).Click();
            mainWindow.Get <Button>(SearchCriteria.ByText("5")).Click();
            mainWindow.Get <Button>(SearchCriteria.ByText("6")).Click();
            mainWindow.Get <Button>(SearchCriteria.ByText("7")).Click();
            mainWindow.Get <Button>(SearchCriteria.ByText("8")).Click();
            //Button with text as +(for sum)
            //Read button to get the result
            mainWindow.Get <Button>(SearchCriteria.ByText("Equals")).Click();

            //Get the result
            var resultLable = mainWindow.Get <Label>(SearchCriteria.ByAutomationId("150"));
            var result      = resultLable.Text;

            Assert.That(result, Is.EqualTo("6912"));
        }
示例#35
0
 public Slider(AutomationElement automationElement, ActionListener actionListener)
     : base(automationElement, actionListener)
 {
     uiItemContainer = new UIItemContainer(automationElement, actionListener, InitializeOption.NoCache, new NullWindowSession());
 }
示例#36
0
        /// <summary>
        /// Manually searches for a <see cref="UIItem"/> in a container.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="automationId">The partial automation ID for the control.</param>
        /// <param name="log">The log object.</param>
        /// <returns>A collection containing all the controls that have an automation ID that matches the partial ID.</returns>
        public static IEnumerable<IUIItem> FindItemsManuallyInUIContainerWithPartialId(UIItemContainer container, string automationId, Log log)
        {
            const string logPrefix = "Controls - Find element manually with partial ID";
            log.Debug(
                logPrefix,
                string.Format(
                    CultureInfo.InvariantCulture,
                    "Searching for UI element with partial ID: [{0}].",
                    automationId));

            var result = new List<IUIItem>();
            if ((container == null) || string.IsNullOrEmpty(automationId))
            {
                return result;
            }

            var stack = new Stack<UIItemContainer>();
            stack.Push(container);
            while (stack.Count > 0)
            {
                var localContainer = stack.Pop();
                foreach (var element in localContainer.Items)
                {
                    log.Debug(
                        logPrefix,
                        string.Format(
                            CultureInfo.InvariantCulture,
                            "Found UI item of type [{0}] with ID: [{1}]. Name: [{2}]",
                            element.GetType().Name,
                            element.Id,
                            element.Name));
                    if ((!string.IsNullOrEmpty(element.Id)) && element.Id.Contains(automationId))
                    {
                        log.Info(
                            logPrefix,
                            string.Format(
                                CultureInfo.InvariantCulture,
                                "Found matching element of type [{0}] with ID: [{1}]",
                                element.GetType().Name,
                                element.Id));
                        result.Add(element);
                    }

                    var subContainer = element as UIItemContainer;
                    if (subContainer != null)
                    {
                        stack.Push(subContainer);
                    }
                }
            }

            return result;
        }
示例#37
0
 internal virtual void SetContainer(UIItemContainer uiItemContainer)
 {
     container = uiItemContainer;
 }
示例#38
0
 // checks all the checkboxes on the "which database objects to select" dialog
 private static void CheckAllCheckBoxes(UIItemContainer pane)
 {
     var tree = pane.Get<Tree>(SearchCriteria.ByControlType(ControlType.Tree));
     foreach (var checkbox in tree.Nodes)
     {
         checkbox.Click();
         Keyboard.Instance.Enter(" ");
     }
 }
 internal AttachedKeyboard(UIItemContainer container, Keyboard keyboard)
 {
     this.container = container;
     this.keyboard = keyboard;
 }