Beispiel #1
0
        public override object Run()
        {
            if (Javascript)
            {
                try
                {
                    var element = Selenium.WebDriver.FindInput(What, Where);
                    element.SendKeys(Text);
                    return(element);
                }
                catch (Exception)
                {
                    throw new ApplicationException($"Element {What} was not found");
                }
            }
            else
            {
                var element = Selenium.WebDriver.FindInput(What, Where);

                var handle = Selenium.GetChromeHandle();

                var screenLocation = Selenium.PutElementOnScreen(element);

                UserInteropAdapter.ClickOnPoint(handle, screenLocation);
                Thread.Sleep(50);
                UserInteropAdapter.SendText(handle, Text, screenLocation);
                Thread.Sleep(50);
                UserBindings.SetForegroundWindow(UserBindings.GetConsoleWindow());

                return(element);
            }
        }
Beispiel #2
0
        public override object Run()
        {
            try
            {
                var elem = Selenium.WebDriver.GetElementByVisibleText(What, Where);

                if (elem == null)
                {
                    elem = Selenium.WebDriver.GetByTagNameAndLocation(new ButtonQuery(What));
                }

                if (Javascript)
                {
                    Selenium.WebDriver.Click(elem);
                }
                else
                {
                    var screenLocation = Selenium.PutElementOnScreen(elem);
                    UserInteropAdapter.ClickOnPoint(Selenium.GetChromeHandle(), screenLocation);
                    Thread.Sleep(50);
                    UserBindings.SetForegroundWindow(UserBindings.GetConsoleWindow());
                }
            }
            catch (Exception)
            {
                throw new ApplicationException($"Element was not found");
            }
            return(null);
        }