예제 #1
0
        public void ShouldAllowUsersToHoverOverElements()
        {
            driver.Url = javascriptPage;

            IRenderedWebElement element = (IRenderedWebElement)driver.FindElement(By.Id("menu1"));

            if (!Platform.CurrentPlatform.IsPlatformType(PlatformType.Windows))
            {
                Assert.Ignore("Skipping test: Simulating hover needs native events");
            }

            IHasInputDevices inputDevicesDriver = driver as IHasInputDevices;

            if (inputDevicesDriver == null)
            {
                return;
            }

            IRenderedWebElement item = (IRenderedWebElement)driver.FindElement(By.Id("item1"));

            Assert.AreEqual("", item.Text);

            ((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].style.background = 'green'", element);
            element.Hover();
            //inputDevicesDriver.ActionBuilder.MoveToElement(element).Build().Perform();

            item = (IRenderedWebElement)driver.FindElement(By.Id("item1"));
            Assert.AreEqual("Item 1", item.Text);
        }
예제 #2
0
        public void ShouldAllowUsersToHoverOverElements()
        {
            driver.Url = javascriptPage;

            IRenderedWebElement element = (IRenderedWebElement)driver.FindElement(By.Id("menu1"));

            if (!Platform.CurrentPlatform.IsPlatformType(PlatformType.Windows))
            {
                Assert.Ignore("Skipping test: Simulating hover needs native events");
            }

            IRenderedWebElement item = (IRenderedWebElement)driver.FindElement(By.Id("item1"));

            Assert.AreEqual("", item.Text);

            ((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].style.background = 'green'", element);
            element.Hover();

            item = (IRenderedWebElement)driver.FindElement(By.Id("item1"));
            Assert.AreEqual("Item 1", item.Text);
        }
예제 #3
0
        //[Test]
        //[Category("Javascript")]
        //[Ignore]
        public void CanClickOnSuckerFishMenuItem()
        {
            driver.Url = javascriptPage;

            IRenderedWebElement element = (IRenderedWebElement)driver.FindElement(By.Id("menu1"));

            if (!Platform.CurrentPlatform.IsPlatformType(PlatformType.Windows))
            {
                Assert.Ignore("Skipping test: Simulating hover needs native events");
            }

            element.Hover();

            IRenderedWebElement target = (IRenderedWebElement)driver.FindElement(By.Id("item1"));

            Assert.IsTrue(target.Displayed);
            target.Click();

            String text = driver.FindElement(By.Id("result")).Text;

            Assert.IsTrue(text.Contains("item 1"));
        }