Exemple #1
0
        protected override string DoImpl()
        {
            var searchValue  = this.Parameters["value"].ToString();
            var searchPolicy = this.Parameters["using"].ToString();

            var searchStrategy = new By(searchPolicy, searchValue);

            WiniumElement winiumElement;

            if (this.ElementId == null)
            {
                winiumElement =
                    WiniumVirtualRoot.Current.Find(TreeScope.Descendants, searchStrategy.Predicate).FirstOrDefault();
            }
            else
            {
                var parentElement = this.Automator.ElementsRegistry.GetRegisteredElement(this.ElementId);
                winiumElement = parentElement.Find(TreeScope.Descendants, searchStrategy.Predicate).FirstOrDefault();
            }

            if (winiumElement == null)
            {
                throw new AutomationException("Element cannot be found", ResponseStatus.NoSuchElement);
            }

            var registeredKey    = this.Automator.ElementsRegistry.RegisterElement(winiumElement);
            var registredObjects = new JsonElementContent(registeredKey);

            return(this.JsonResponse(ResponseStatus.Success, registredObjects));
        }
        protected override string DoImpl()
        {
            var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();

            var index = this.ExecutedCommand.Parameters["index"].ToString();

            var text = this.ExecutedCommand.Parameters["text"].ToString();

            var element = this.Automator.ElementsRegistry.GetRegisteredElement(registeredKey);

            Grid grid = element.FlaUIElement.AsGrid();

            var result = grid.RemoveFromSelection(int.Parse(index), text);

            if (result == null)
            {
                throw new AutomationException("Element cannot be found", ResponseStatus.NoSuchElement);
            }

            var itemRegisteredKey = this.Automator.ElementsRegistry.RegisterElement(new FlaUIDriverElement(result));

            var registeredObject = new JsonElementContent(itemRegisteredKey);

            return(this.JsonResponse(ResponseStatus.Success, registeredObject));
        }
        protected override string DoImpl()
        {
            var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();

            var value = this.ExecutedCommand.Parameters["value"].ToString();

            var element = this.Automator.ElementsRegistry.GetRegisteredElement(registeredKey);

            ComboBox comboBox = element.FlaUIElement.AsComboBox();

            ComboBoxItem item;

            if (comboBox.Patterns.Selection.IsSupported)
            {
                item = comboBox.Select(int.Parse(value));
                comboBox.Collapse();
            }
            else
            {
                item = comboBox.Items.ElementAt(int.Parse(value));
                item.Click();
            }

            if (item == null)
            {
                throw new AutomationException("Element cannot be found", ResponseStatus.NoSuchElement);
            }

            var itemRegisteredKey = this.Automator.ElementsRegistry.RegisterElement(new FlaUIDriverElement(item));

            var registeredObject = new JsonElementContent(itemRegisteredKey);

            return(this.JsonResponse(ResponseStatus.Success, registeredObject));
        }
        protected override string DoImpl()
        {
            var registeredKey    = this.Automator.ElementsRegistry.RegisterElement(CruciatusFactory.FocusedElement);
            var registeredObject = new JsonElementContent(registeredKey);

            return(this.JsonResponse(ResponseStatus.Success, registeredObject));
        }
Exemple #5
0
        protected override string DoImpl()
        {
            var parentKey      = this.ExecutedCommand.Parameters["ID"].ToString();
            var searchValue    = this.ExecutedCommand.Parameters["value"].ToString();
            var searchStrategy = this.ExecutedCommand.Parameters["using"].ToString();

            var parent = this.Automator.ElementsRegistry.GetRegisteredElement(parentKey);

            AutomationElement element;

            if (searchStrategy.Equals("xpath"))
            {
                element = ByXpath.FindFirstByXPath(searchValue, parent.FlaUIElement);
            }
            else
            {
                var condition = ByHelper.GetStrategy(searchStrategy, searchValue);

                element = parent.FlaUIElement.FindFirstDescendant(condition);
            }

            if (element == null)
            {
                throw new AutomationException("Element cannot be found", ResponseStatus.NoSuchElement);
            }

            var registeredKey    = this.Automator.ElementsRegistry.RegisterElement(new FlaUIDriverElement(element));
            var registeredObject = new JsonElementContent(registeredKey);

            return(this.JsonResponse(ResponseStatus.Success, registeredObject));
        }
        protected override string DoImpl()
        {
            var activeWindow = DriverManager.GetActiveWindow();

            var itemRegisteredKey = this.Automator.ElementsRegistry.RegisterElement(new FlaUIDriverElement(activeWindow));

            var registeredObject = new JsonElementContent(itemRegisteredKey);

            return(this.JsonResponse(ResponseStatus.Success, registeredObject));
        }
        protected override string DoImpl()
        {
            AutomationElement uiItem = DriverManager.GetActiveWindow().Automation.FocusedElement();

            if (uiItem == null)
            {
                throw new AutomationException("Active cannot be found ", ResponseStatus.NoSuchElement);
            }

            var registeredKey    = this.Automator.ElementsRegistry.RegisterElement(new FlaUIDriverElement(uiItem));
            var registeredObject = new JsonElementContent(registeredKey);

            return(this.JsonResponse(ResponseStatus.Success, registeredObject));
        }
        protected override string DoImpl()
        {
            var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();

            var comboBox = this.Automator.ElementsRegistry.GetRegisteredElement(registeredKey).ToComboBox();

            var selectedItem = comboBox.SelectedItem();

            if (selectedItem == null)
            {
                throw new AutomationException("No items is selected", ResponseStatus.NoSuchElement);
            }

            var selectedItemKey  = this.Automator.ElementsRegistry.RegisterElement(selectedItem);
            var registeredObject = new JsonElementContent(selectedItemKey);

            return(this.JsonResponse(ResponseStatus.Success, registeredObject));
        }
        protected override string DoImpl()
        {
            var searchValue    = this.ExecutedCommand.Parameters["value"].ToString();
            var searchStrategy = this.ExecutedCommand.Parameters["using"].ToString();

            var strategy = ByHelper.GetStrategy(searchStrategy, searchValue);
            var element  = CruciatusFactory.Root.FindElement(strategy);

            if (element == null)
            {
                throw new AutomationException("Element cannot be found", ResponseStatus.NoSuchElement);
            }

            var registeredKey    = this.Automators.ElementsRegistry.RegisterElement(element);
            var registeredObject = new JsonElementContent(registeredKey);

            return(this.JsonResponse(ResponseStatus.Success, registeredObject));
        }
Exemple #10
0
        protected override string DoImpl()
        {
            var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();

            var element = this.Automator.ElementsRegistry.GetRegisteredElement(registeredKey);

            var titleBar = element.FlaUIElement.AsTitleBar();

            var result = titleBar.MinimizeButton;

            if (result == null)
            {
                throw new AutomationException("Element cannot be found", ResponseStatus.NoSuchElement);
            }

            var itemRegisteredKey = this.Automator.ElementsRegistry.RegisterElement(new FlaUIDriverElement(result));

            var registeredObject = new JsonElementContent(itemRegisteredKey);

            return(this.JsonResponse(ResponseStatus.Success, registeredObject));
        }
        protected override string DoImpl()
        {
            var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();

            var element = this.Automator.ElementsRegistry.GetRegisteredElement(registeredKey);

            ComboBox comboBox = element.FlaUIElement.AsComboBox();

            ComboBoxItem item = comboBox.SelectedItem;

            if (item == null)
            {
                throw new AutomationException("Element cannot be found", ResponseStatus.NoSuchElement);
            }

            var itemRegisteredKey = this.Automator.ElementsRegistry.RegisterElement(new FlaUIDriverElement(item));

            var registeredObject = new JsonElementContent(itemRegisteredKey);

            return(this.JsonResponse(ResponseStatus.Success, registeredObject));
        }
Exemple #12
0
        public override string DoImpl()
        {
            var searchValue  = this.Parameters["value"].ToString();
            var searchPolicy = this.Parameters["using"].ToString();

            DependencyObject relativeElement = this.ElementId == null
                                                   ? this.Automator.VisualRoot
                                                   : this.Automator.WebElements.GetRegisteredElement(this.ElementId);

            var searchStrategy = new By(searchPolicy, searchValue);
            var webObjectId    = this.FindElementBy(relativeElement, searchStrategy);

            if (webObjectId == null)
            {
                throw new AutomationException("Element cannot be found", ResponseStatus.NoSuchElement);
            }

            var webElement = new JsonElementContent(webObjectId);

            return(this.JsonResponse(ResponseStatus.Success, webElement));
        }
        protected override string DoImpl()
        {
            var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();

            var element = this.Automator.ElementsRegistry.GetRegisteredElement(registeredKey);

            DataGridView item = element.FlaUIElement.AsDataGridView();

            DataGridViewHeader header = item.Header;

            if (header == null)
            {
                throw new AutomationException("Element cannot be found", ResponseStatus.NoSuchElement);
            }

            var itemRegisteredKey = this.Automator.ElementsRegistry.RegisterElement(new FlaUIDriverElement(header));

            var registeredObject = new JsonElementContent(itemRegisteredKey);

            return(this.JsonResponse(ResponseStatus.Success, registeredObject));
        }
        protected override string DoImpl()
        {
            var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();

            var value = this.ExecutedCommand.Parameters["value"].ToString();

            var element = this.Automator.ElementsRegistry.GetRegisteredElement(registeredKey);

            GridRow gridRow = element.FlaUIElement.AsGridRow();

            var result = gridRow.FindCellByText(value);

            if (result == null)
            {
                throw new AutomationException("Element cannot be found", ResponseStatus.NoSuchElement);
            }

            var itemRegisteredKey = this.Automator.ElementsRegistry.RegisterElement(new FlaUIDriverElement(result));

            var registeredObject = new JsonElementContent(itemRegisteredKey);

            return(this.JsonResponse(ResponseStatus.Success, registeredObject));
        }
        protected override string DoImpl()
        {
            var searchValue    = this.ExecutedCommand.Parameters["value"].ToString();
            var searchStrategy = this.ExecutedCommand.Parameters["using"].ToString();


            AutomationElement activeWindow = DriverManager.GetActiveWindow();

            AutomationElement element;

            if (searchStrategy.Equals("xpath"))
            {
                if (searchValue.StartsWith("#"))
                {
                    searchValue  = searchValue.TrimStart('#');
                    activeWindow = activeWindow.Automation.GetDesktop();
                }

                element = ByXpath.FindFirstByXPath(searchValue, activeWindow);
            }
            else
            {
                var condition = ByHelper.GetStrategy(searchStrategy, searchValue);

                element = activeWindow.FindFirstDescendant(condition);
            }

            if (element == null)
            {
                throw new AutomationException("Element cannot be found", ResponseStatus.NoSuchElement);
            }

            var registeredKey    = this.Automator.ElementsRegistry.RegisterElement(new FlaUIDriverElement(element));
            var registeredObject = new JsonElementContent(registeredKey);

            return(this.JsonResponse(ResponseStatus.Success, registeredObject));
        }
Exemple #16
0
        protected override string DoImpl()
        {
            var dataGridKey = this.ExecutedCommand.Parameters["ID"].ToString();
            var column      = int.Parse(this.ExecutedCommand.Parameters["COLUMN"].ToString());
            var row         = int.Parse(this.ExecutedCommand.Parameters["ROW"].ToString());

            var dataGrid = this.Automators.ElementsRegistry.GetRegisteredElement(dataGridKey).ToDataGrid();

            WindowAppElement dataGridCell;

            try
            {
                dataGridCell = dataGrid.Item(row, column);
            }
            catch (CruciatusException exception)
            {
                return(this.JsonResponse(ResponseStatus.NoSuchElement, exception));
            }

            var registeredKey    = this.Automators.ElementsRegistry.RegisterElement(dataGridCell);
            var registeredObject = new JsonElementContent(registeredKey);

            return(this.JsonResponse(ResponseStatus.Success, registeredObject));
        }