예제 #1
0
        public void ByTextAndTag_Unfound_Text()
        {
            SetUp();

            var foundElements = Driver.FindElements(ByExtension.TextAndTag("Page 1", "p"));

            Assert.AreEqual(0, foundElements.Count);
        }
예제 #2
0
        internal ByLabel(string labelText)
        {
            if (string.IsNullOrEmpty(labelText))
            {
                throw new ArgumentException("The text to find cannot be null or empty", "textToFind");
            }

            LabelBy = ByExtension.TextAndTag(labelText, "label");
        }
예제 #3
0
        public void ByTextAndTag_Multiple_Matching_Tags()
        {
            SetUp();
            var aTag  = Driver.FindElement(By.LinkText("Page 3"));
            var liTag = Driver.FindElement(By.Id("navP3"));

            var resultList = Driver.FindElements(ByExtension.TextAndTag("Page 3", "a", "li"));

            Assert.AreEqual(2, resultList.Count);
        }
예제 #4
0
        public void ByTextAndTag_Parent_Element()
        {
            SetUp();

            var expectedElement = Driver.FindElement(By.Id("navP4"));

            var resultElement = Driver.FindElement(ByExtension.TextAndTag("Page 4", "li"));

            Assert.AreEqual(expectedElement, resultElement);
        }
예제 #5
0
        public void ByTextAndTag_Simple()
        {
            SetUp();

            var expectedElement = Driver.FindElement(By.LinkText("Page 1"));

            var resultElement = Driver.FindElement(ByExtension.TextAndTag("Page 1", "a"));

            Assert.AreEqual(expectedElement, resultElement);
        }
예제 #6
0
 /// <summary>
 /// Locates the element based on the linkText argument and performs the Click method on that element
 /// </summary>
 /// <remarks>Uses ByExtension.TextAndTag to avoid inconsistent results from By.LinkText</remarks>
 public void ClickLink(string linkText)
 {
     this.FindElement(ByExtension.TextAndTag(linkText, "a")).Click();
 }