public void TestAttributeWithNoTagNameAndPropertyThrowsAnException() { var attribute = new ElementLocatorAttribute { Type = "submit" }; LocatorBuilder.GetElementLocators(attribute); }
public void TestAttributeWithNoTagNameAndPropertyThrowsAnException() { var attribute = new ElementLocatorAttribute { Type = "submit" }; Assert.Throws <ElementExecuteException>(() => LocatorBuilder.GetElementLocators(attribute)); }
public void TestAttributeWithLinkTextReturnsLinkTextLocator() { var attribute = new ElementLocatorAttribute { Text = "Hello World" }; var resultList = LocatorBuilder.GetElementLocators(attribute); Assert.AreEqual(1, resultList.Count); var item = resultList.First(); Assert.AreEqual(By.LinkText("Hello World"), item); }
public void TestAttributeWithCssClassReturnsCssClassLocator() { var attribute = new ElementLocatorAttribute { Class = ".something" }; var resultList = LocatorBuilder.GetElementLocators(attribute); Assert.AreEqual(1, resultList.Count); var item = resultList.First(); Assert.AreEqual(By.ClassName(".something"), item); }
public void TestAttributeWithNameReturnsNameLocator() { var attribute = new ElementLocatorAttribute { Name = "MyName" }; var resultList = LocatorBuilder.GetElementLocators(attribute); Assert.AreEqual(1, resultList.Count); var item = resultList.First(); Assert.AreEqual(By.Name("MyName"), item); }
public void TestAttributeWithIdReturnsCssSelectorLocator() { var attribute = new ElementLocatorAttribute { CssSelector = "div#MyId" }; var resultList = LocatorBuilder.GetElementLocators(attribute); Assert.AreEqual(1, resultList.Count); var item = resultList.First(); Assert.AreEqual(By.CssSelector("div#MyId"), item); }
public void TestAttributeWithTagNameAndTypeAndTitleReturnsCompoundXPathLocator() { var attribute = new ElementLocatorAttribute { TagName = "input", Type = "email", Title = "my title" }; var resultList = LocatorBuilder.GetElementLocators(attribute); Assert.AreEqual(1, resultList.Count); var item = resultList.First(); Assert.AreEqual(By.XPath("//input[@title='my title' and @type='email']"), item); }
public void TestAttributeWithTagNameAndTypeAndIndexReturnsComplexXPathLocator() { var attribute = new ElementLocatorAttribute { TagName = "input", Type = "email", Index = 1 }; var resultList = LocatorBuilder.GetElementLocators(attribute); Assert.AreEqual(1, resultList.Count); var item = resultList.First(); Assert.AreEqual(By.XPath("(//input[@type='email'])[0]"), item); }
public void TestAttributeWithLinkAreaTagAndUrlReturnsXPathLocator() { var attribute = new ElementLocatorAttribute { TagName = "area", Url = "mylink.htm" }; var resultList = LocatorBuilder.GetElementLocators(attribute); Assert.AreEqual(1, resultList.Count); var item = resultList.First(); Assert.AreEqual(By.XPath("//area[@href='mylink.htm']"), item); }
public void TestAttributeWithImageTagAndUrlReturnsXPathLocator() { var attribute = new ElementLocatorAttribute { TagName = "img", Url = "myimage.png" }; var resultList = LocatorBuilder.GetElementLocators(attribute); Assert.AreEqual(1, resultList.Count); var item = resultList.First(); Assert.AreEqual(By.XPath("//img[@src='myimage.png']"), item); }
public void TestAttributeWithIdReturnsIdLocator() { var attribute = new ElementLocatorAttribute { Id = "MyId" }; var resultList = LocatorBuilder.GetElementLocators(attribute); Assert.AreEqual(1, resultList.Count); var item = resultList.First(); Assert.AreEqual(By.Id("MyId"), item); }
public void TestAttributeWithXPathReturnsXPathLocator() { var attribute = new ElementLocatorAttribute { XPath = ".//[@element='row']" }; var resultList = LocatorBuilder.GetElementLocators(attribute); Assert.AreEqual(1, resultList.Count); var item = resultList.First(); Assert.AreEqual(By.XPath(".//[@element='row']"), item); }
public void TestAttributeWithTagNameAndAltReturnsXPathLocator() { var attribute = new ElementLocatorAttribute { TagName = "input", Alt = "test" }; var resultList = LocatorBuilder.GetElementLocators(attribute); Assert.AreEqual(1, resultList.Count); var item = resultList.First(); Assert.AreEqual(By.XPath("//input[@alt='test']"), item); }
public void TestAttributeWithTagNameReturnsTagLocator() { var attribute = new ElementLocatorAttribute { TagName = "input" }; var resultList = LocatorBuilder.GetElementLocators(attribute); Assert.AreEqual(1, resultList.Count); var item = resultList.First(); Assert.AreEqual(By.TagName("input"), item); }
public void TestAttributeWithIdAndTagNameReturnsTwoLocators() { var attribute = new ElementLocatorAttribute { Id = "MyId", TagName = "a" }; var resultList = LocatorBuilder.GetElementLocators(attribute); Assert.AreEqual(2, resultList.Count); var item = resultList.First(); Assert.AreEqual(By.Id("MyId"), item); var item2 = resultList.Last(); Assert.AreEqual(By.TagName("a"), item2); }