Example #1
0
        public bool LaunchApplication(string appPath, string appTitle)
        {
            var desktop = this.GetDektopRoot();

            desktop.PressKeysCombination(Keys.Windows, 'r');

            IUiElementWrapper runner = null;
            int attempts             = 0;

            while (runner == null && attempts < 15)
            {
                runner = this.GetApplicationRoot("Run");
            }

            runner.SendKeys(appPath);
            runner.PressKey(Keys.Enter);

            IUiElementWrapper result = null;

            while (result == null && attempts < 15)
            {
                result = this.GetApplicationRoot(appTitle);
            }

            return(result != null);
        }
Example #2
0
 public Element(IUiElementWrapper uiInstance, Navigator navigator, ILogger logger, IElementFactory eFactory)
 {
     this.UiInstance     = uiInstance ?? throw new ArgumentNullException(nameof(IUiElementWrapper));
     this.navigator      = navigator ?? throw new ArgumentNullException(nameof(Navigator));
     this.logger         = logger ?? throw new ArgumentNullException(nameof(ILogger));
     this.elementFactory = eFactory;
 }
Example #3
0
 public MenuBar(
     IUiElementWrapper wrapper,
     Navigator navigator,
     IElementFactory eFactory,
     ILogger logger) : base(wrapper, navigator, logger, eFactory)
 {
     this.uiWrapper = wrapper;
     this.logger    = logger;
 }
Example #4
0
 public FileMenu(
     IUiElementWrapper wrapper,
     Navigator navigator,
     IElementFactory eFactory,
     ILogger logger) : base(wrapper, navigator, logger, eFactory)
 {
     this.uiWrapper    = wrapper;
     this.logger       = logger;
     this.awaitHandler = navigator.AwaitService;
 }
Example #5
0
        public bool CloseApplication(string appTitle)
        {
            var desktop = this.GetDektopRoot();

            desktop.PressKeysCombination(Keys.Windows, 'r');

            IUiElementWrapper runner = null;
            int attempts             = 0;

            while (runner == null && attempts < this.settings.TryAttemptsFindOrClose)
            {
                runner = this.GetApplicationRoot("Run");
            }

            runner.SendKeys($"taskkill /IM notepad.exe /F");
            runner.PressKey(Keys.Enter);

            return(true);
        }
        public T CreateElement <T>(IUiElementWrapper wrapper, Navigator navigator, IElementFactory eFactory, ILogger logger)
            where T : Element
        {
            Type type = typeof(T);

            if (type == typeof(Element))
            {
                return(new Element(wrapper, navigator, logger, eFactory) as T);
            }
            else if (type == typeof(MenuBar))
            {
                return(new MenuBar(wrapper, navigator, eFactory, logger) as T);
            }
            else if (type == typeof(FileMenu))
            {
                return(new FileMenu(wrapper, navigator, eFactory, logger) as T);
            }
            else if (type == typeof(EditMenu))
            {
                return(new EditMenu(wrapper, navigator, eFactory, logger) as T);
            }
            else if (type == typeof(ViewMenu))
            {
                return(new ViewMenu(wrapper, navigator, eFactory, logger) as T);
            }
            else if (type == typeof(TextEditor))
            {
                return(new TextEditor(wrapper, navigator, eFactory, logger) as T);
            }
            else if (type == typeof(ButtonElement))
            {
                return(new ButtonElement(wrapper, navigator, eFactory, logger) as T);
            }
            else
            {
                return(default);
Example #7
0
 public WindowsRootWindow(IUiElementWrapper wrapper, Navigator navigator, ILogger logger, IElementFactory eFactory)
     : base(wrapper, navigator, logger, eFactory)
 {
     this.logger = logger;
 }
Example #8
0
 public ButtonElement(IUiElementWrapper uiWrapper, Navigator navigator, IElementFactory eFactory, ILogger logger)
     : base(uiWrapper, navigator, logger, eFactory)
 {
     this.logger  = logger;
     this.wrapper = uiWrapper;
 }