vendredi 4 septembre 2015

Coded UI HtmlTable's Rows and Cells properties are null

I try to automate a test, try to reach an HtmlTable object, but it's not that easy.. If I add it to the UImap, the designer file shows it as a HtmlTable, but I can't locate it from the map. If I try to find it manually it works, but the Rows and Cells properties are nulls but the CellCount and RowCount are showing the correct values. The only way I can reach the cells is to separate the HtmlTable to two HtmlCustom controls. The first one's "TagName" is "THEAD" and the second's is "TBODY".

        HtmlCustom parent = new HtmlCustom(htmlTable);
        parent.SearchProperties.Add("TagName","TBODY");
        parent.SearchProperties.Add("ClassName","HtmlTag.TBODY");

       var firstchild = parent.GetChildren();
        foreach(var secondchild in firstchild)
        {
            var thrdchild = secondchild.GetChildren();

            foreach (var cells in thrdchild)
            {
                //do sg
            }
        }

After the separation I can get the children with the GetChildren() function (basically the Rows), but in some cases the GetChildren returns null.. I can't find anything about this issue. What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire