コード例 #1
0
        public void SelectionSelectBySymbol()
        {
            driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("single_text_input.html");

            IWebElement input = driver.FindElement(By.Id("textInput"));

            new Actions(driver).Click(input).SendKeys("abc def").Perform();

            WaitFor(() => input.GetAttribute("value") == "abc def", "did not send initial keys");

            if (!TestUtilities.IsInternetExplorer(driver))
            {
                // When using drivers other than the IE, the click in
                // the below action sequence may fall inside the double-
                // click threshold (the IE driver has guards to prevent
                // inadvertent double-clicks with multiple actions calls),
                // so we call the "release actions" end point before
                // doing the second action.
                IActionExecutor executor = driver as IActionExecutor;
                if (executor != null)
                {
                    executor.ResetInputState();
                }
            }

            new Actions(driver).Click(input)
            .KeyDown(Keys.Shift)
            .SendKeys(Keys.Left)
            .SendKeys(Keys.Left)
            .KeyUp(Keys.Shift)
            .SendKeys(Keys.Delete)
            .Perform();

            Assert.That(input.GetAttribute("value"), Is.EqualTo("abc d"));
        }
コード例 #2
0
        public void SelectionSelectByWord()
        {
            driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("single_text_input.html");

            IWebElement input = driver.FindElement(By.Id("textInput"));

            new Actions(driver).Click(input).SendKeys("abc def").Perform();

            WaitFor(() => input.GetAttribute("value") == "abc def", "did not send initial keys");

            if (TestUtilities.IsFirefox(driver))
            {
                // When using geckodriver, the click in the below action
                // sequence may fall inside the double-click threshold,
                // so we call the "release actions" end point before
                // doing the second action.
                IActionExecutor executor = driver as IActionExecutor;
                if (executor != null)
                {
                    executor.ResetInputState();
                }
            }

            new Actions(driver).Click(input)
            .KeyDown(Keys.Shift)
            .KeyDown(Keys.Control)
            .SendKeys(Keys.Left)
            .KeyUp(Keys.Control)
            .KeyUp(Keys.Shift)
            .SendKeys(Keys.Delete)
            .Perform();

            WaitFor(() => input.GetAttribute("value") == "abc ", "did not send editing keys");
        }
コード例 #3
0
 public void SetupTest()
 {
     IActionExecutor actionExecutor = driver as IActionExecutor;
     if (actionExecutor != null)
     {
         actionExecutor.ResetInputState();
     }
 }
コード例 #4
0
        public void ReleaseModifierKeys()
        {
            // new Actions(driver).SendKeys(Keys.Null).Perform();
            IActionExecutor actionExecutor = driver as IActionExecutor;

            if (actionExecutor != null)
            {
                actionExecutor.ResetInputState();
            }
        }
コード例 #5
0
        public void Setup()
        {
            new Actions(driver).SendKeys(Keys.Null).Perform();
            IActionExecutor actionExecutor = driver as IActionExecutor;

            if (actionExecutor != null)
            {
                actionExecutor.ResetInputState();
            }
        }
コード例 #6
0
        public void SetupTest()
        {
            IActionExecutor actionExecutor = driver as IActionExecutor;

            if (actionExecutor != null)
            {
                actionExecutor.ResetInputState();
            }
            driver.SwitchTo().DefaultContent();
            ((IJavaScriptExecutor)driver).ExecuteScript("window.scrollTo(0, 0)");
        }