Order of elements

Thread is closed for posting
2 posts, 0 answers
  1. Sandeep Endapally
    Sandeep Endapally avatar
    8 posts
    Member since:
    Jul 2009

    Posted 03 Sep 2009 Link to this post

    Is there is any way to test the order of elements on a web page. I mean, if the developer changes the order of elements

    on a webpage and runs the previous created test script, it should fail. Is that possible?

  2. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 04 Sep 2009 Link to this post

    Hello Sandeep Endapally,

    Yes there are a couple of methods you can use to verify the order of elements. The quick method would be to select the element and craft a verification step that would verify the InnerMarkup or the InnerText equals a specific value. For example, if you have a UL element that contains a number of LI elements, you would locate the UL element in DOM explorer, right click on it and select Record Options, select Verification, then constuct a verification of the InnerText or the InnerMarkup is exact to some value.

    The other method is to add a code behind method that does something like this:

    [CodedStep(@"Verify 'InnerMarkup' 'Exact' '<LI class=chooseSample jQuery1252081125277=\7\>Choose sample</LI><LI class=active jQuery1252081125277=\8\><A id=demo1 href=\#\ jQuery1252081125277=\2\>Editor with all features</A></LI><LI jQuery1252081125277=\9\><A id=demo_uicolor href=\#\ jQuery1252081125277=\3\>Interface color</A></LI><LI jQuery1252081125277=\10\><A id=demo2 href=\#\ jQuery1252081125277=\4\>Multi-language interface</A></LI><LI jQuery1252081125277=\11\><A id=demo3 href=\#\ jQuery1252081125277=\5\>Custom toolbar</A></LI><LI jQuery1252081125277=\12\><A id=demo4 href=\#\ jQuery1252081125277=\6\>Skins</A><!--            <li class=\moreSamples\><a href=\#\>More samples</a></li>  --></LI>' on 'ul_1'")]  
    public void webaiitest1_CodedStep()  
    {  
     
        // Verify 'InnerMarkup' 'Exact' '<LI class=chooseSample jQuery1252081125277="7">Choose sample</LI><LI class=active jQuery1252081125277="8"><A id=demo1 href="#" jQuery1252081125277="2">Editor with all features</A></LI><LI jQuery1252081125277="9"><A id=demo_uicolor href="#" jQuery1252081125277="3">Interface color</A></LI><LI jQuery1252081125277="10"><A id=demo2 href="#" jQuery1252081125277="4">Multi-language interface</A></LI><LI jQuery1252081125277="11"><A id=demo3 href="#" jQuery1252081125277="5">Custom toolbar</A></LI><LI jQuery1252081125277="12"><A id=demo4 href="#" jQuery1252081125277="6">Skins</A><!--            <li class="moreSamples"><a href="#">More samples</a></li>  --></LI>' on 'ul_1'  
        HtmlControl ul_1 = Pages.Demo__CKEditor.ul_1;  
        ul_1.Wait.ForExists(10000);  
        Assert.AreEqual(7, ul_1.BaseElement.ChildNodes.Count, "Selection menu count is incorrect");  
        Assert.AreEqual("Choose sample", ul_1.BaseElement.ChildNodes[0].InnerText);  
        Assert.AreEqual("Editor with all features", ul_1.BaseElement.ChildNodes[1].InnerText);  
        Assert.AreEqual("Interface color", ul_1.BaseElement.ChildNodes[2].InnerText);  
        Assert.AreEqual("Multi-language interface", ul_1.BaseElement.ChildNodes[3].InnerText);  
        Assert.AreEqual("Custom toolbar", ul_1.BaseElement.ChildNodes[4].InnerText);  
        Assert.AreEqual("Skins", ul_1.BaseElement.ChildNodes[5].InnerText);  
        Assert.AreEqual("", ul_1.BaseElement.ChildNodes[6].InnerMarkup);  
    }

    If you still need assistance, I need more details of what/where exactly you'd like to verify the order of something, along with sample HTML code to study. Then I can give you better assistance for your speciric test case.

    Best wishes,
    Cody
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top