Exemplo n.º 1
0
        public NewProjectDialog ClickNewProject()
        {
            IUIItem file = window.Get(SearchCriteria.ByText("File"));

            file.Click();

            IUIItem newItem = window.Get(SearchCriteria.ByText("New"));

            newItem.Click();

            IUIItem projectItem = window.Get(SearchCriteria.ByText("Project..."));

            projectItem.Click();


            // Just take the first since it will (should!) be the only one
            var dialog = new NewProjectDialog(window.ModalWindows()[0]);

            return(dialog);
        }
Exemplo n.º 2
0
        public void SetGridSize(Difficulty dif)
        {
            MenuBar mb       = MainWindow.GetMenuBar(SearchCriteria.ByText("Application"));
            Menu    gameMenu = mb.TopLevelMenu.Find(x => x.Name == "Game");

            gameMenu.Click();
            Menu opt = gameMenu.ChildMenus.Find(x => x.Name == "Options");

            opt.Click();
            Window Options   = _application.GetWindow("Options");
            var    Selection = Options.Items.Find(x => x.Name.Contains(dif.ToString()));

            Selection.Click();
            IUIItem ok = Options.Items.Find(x => x.Name == "OK");

            ok.Click();

            List <IUIItem> buttonElements = MainWindow.Items.FindAll(x => x.Name.Contains("Concealed"));

            TileWorkers = new List <BackgroundWorker>();
            List <Tile> tiles = CreateTiles(buttonElements);

            Board = new Grid(tiles);
        }
Exemplo n.º 3
0
 public void Click()
 {
     TestLogger.Instance.Info($"Clicking on '{_name}'");
     _source.Click();
 }
 public void ClickIUIItem(IUIItem item)
 {
     item.Click();
 }
Exemplo n.º 5
0
 public void Click()
 {
     IsElementPresent();
     LoggerUtil.Log.Info($"Clicking element {UiItem.Name}");
     UiItem.Click();
 }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            var         directoryName   = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var         markpadLocation = Path.Combine(directoryName, @"putty.exe");
            Application application     = Application.Launch(markpadLocation);
            Window      window          = application.GetWindow("PuTTY Configuration", InitializeOption.NoCache);

            try
            {
                SearchCriteria searchCriteria = SearchCriteria.ByText("Host Name (or IP address)").AndIndex(1);
                TextBox        j = (TextBox)window.Get(searchCriteria);
                j.SetValue("192.168.0.221");
                SearchCriteria searchCriteria2 = SearchCriteria.All.AndIndex(29);
                IUIItem        k = window.Get(searchCriteria2);
                k.Click();
                Thread.Sleep(2000);
                List <Window> windows = application.GetWindows();
                foreach (Window w in windows)
                {
                    w.Keyboard.Enter("root\n");
                    //for (int i = 0; i < 100; i++)
                    //{
                    SearchCriteria    searchCriteria3 = SearchCriteria.All.AndIndex(0);
                    AutomationElement ae     = w.GetElement(searchCriteria3);
                    TreeWalker        walker = TreeWalker.ControlViewWalker;
                    AutomationElement parent = walker.GetParent(ae);
                    System.Console.WriteLine(parent.Current.Name);
                    AutomationElementCollection children = parent.FindAll(TreeScope.Descendants, Condition.TrueCondition);
                    foreach (AutomationElement child in children)
                    {
                        if (child.Current.IsContentElement)
                        {
                            AutomationProperty[] aps = child.GetSupportedProperties();
                            foreach (AutomationProperty ap in aps)
                            {
                                System.Console.WriteLine(ap.GetType() + ":" + ap.ProgrammaticName + ":" + ap.Id);
                                System.Console.WriteLine(child.GetCurrentPropertyValue(ap).ToString());
                            }
                        }
                    }
                    //}
                }

                /*for (int i = 0; i < 100; i++)
                 * {
                 *  SearchCriteria searchCriteria = SearchCriteria.All.AndIndex(i);
                 *  IUIItem j = window.Get(searchCriteria);
                 *  System.Console.WriteLine(i + ":" + j.ToString());
                 * }*/
            }
            catch (AutomationException e)
            {
                System.Console.WriteLine(e.ToString());
            }

            /*Button button = (Button)window.Get(searchCriteria);
             * button.Click();
             * Thread.Sleep(2000);
             * List<Window> windows = application.GetWindows();
             * foreach (Window w in windows)
             * {
             *  if (w.ToString().Equals("New Task"))
             *  {
             *      SearchCriteria searchCriteria2 = SearchCriteria.All.AndIndex(5);
             *      TextBox txtBx = (TextBox)w.Get(searchCriteria2);
             *      txtBx.SetValue("New Event");
             *  }
             *
             * }*/
            /* Window window = application.GetWindow("Wpf Todo", InitializeOption.NoCache);
             *
             * SearchCriteria searchCriteria = SearchCriteria.All.AndIndex(4);
             * Button button = (Button)window.Get(searchCriteria);
             * button.Click();
             * Thread.Sleep(2000);
             * List<Window> windows = application.GetWindows();
             * foreach (Window w in windows)
             * {
             *   if (w.ToString().Equals("New Task"))
             *   {
             *       SearchCriteria searchCriteria2 = SearchCriteria.All.AndIndex(5);
             *       TextBox txtBx = (TextBox)w.Get(searchCriteria2);
             *       txtBx.SetValue("New Event");
             *   }
             *
             * }*/
        }