Search code examples
telerikautomated-testswebaii

WebAii/ArtOfTest - Testing contents of <p> tags?


I'm writing some automation tests using the free version of WebAii/ArtOfTest. I'm trying to grab a <p> tag so I can verify the contents. I see classes for most tag types (eg. HtmlDiv, HtmlSpan, etc), but don't see one for <p> tags.

Is there a class I'm missing or is there another way to grab the <p> tag and verify it's contents?


Solution

  • They key question is what characteristics of your < p > tag do we use to locate it? Does it have an id attribute? Is it the first one contained in a < div > that has an id?

    Here's a quick sample of one possible way of verifying text content:

            HtmlControl p = Find.ByExpression<HtmlControl>("id=desc");
            Assert.IsTrue(p.BaseElement.TextContent.Contains("Ipsum Lorem Facto"));
    

    Also feel free to bring all your framework questions over to our Telerik Testing Framework form at http://www.telerik.com/automated-testing-tools/community/forums/webui-test-studio-developer-edition/webaii-automation-framework.aspx where us support people hang out and answer these sorts of questions.

    Cody, Telerik Support Officer