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

            IRenderedWebElement element = (IRenderedWebElement)driver.FindElement(By.Id("green-parent"));
            String backgroundColour     = element.GetValueOfCssProperty("background-color");

            Assert.AreEqual("#008000", backgroundColour);

            element          = (IRenderedWebElement)driver.FindElement(By.Id("red-item"));
            backgroundColour = element.GetValueOfCssProperty("background-color");

            Assert.AreEqual("#ff0000", backgroundColour);
        }
예제 #2
0
        public void ShouldAllowInheritedStylesToBeUsed()
        {
            driver.Url = javascriptPage;

            IRenderedWebElement element = (IRenderedWebElement)driver.FindElement(By.Id("green-item"));
            String backgroundColour     = element.GetValueOfCssProperty("background-color");

            Assert.AreEqual("transparent", backgroundColour);
        }
예제 #3
0
        public void ShouldHandleNonIntegerPositionAndSize()
        {
            driver.Url = rectanglesPage;

            IRenderedWebElement r2 = (IRenderedWebElement)driver.FindElement(By.Id("r2"));
            String left            = r2.GetValueOfCssProperty("left");

            Assert.IsTrue(left.StartsWith("10.9"), "left (\"" + left + "\") should start with \"10.9\".");
            String top = r2.GetValueOfCssProperty("top");

            Assert.IsTrue(top.StartsWith("10.1"), "top (\"" + top + "\") should start with \"10.1\".");
            Assert.AreEqual(new Point(11, 10), r2.Location);
            String width = r2.GetValueOfCssProperty("width");

            Assert.IsTrue(width.StartsWith("48.6"), "width (\"" + left + "\") should start with \"48.6\".");
            String height = r2.GetValueOfCssProperty("height");

            Assert.IsTrue(height.StartsWith("49.3"), "height (\"" + left + "\") should start with \"49.3\".");
            Assert.AreEqual(r2.Size, new Size(49, 49));
        }