Issue with AddHierarchyConstraits of HtmlFindExpression

3 posts, 0 answers
  1. Vinay
    Vinay avatar
    16 posts
    Member since:
    Jan 2015

    Posted 02 Jun 2015 Link to this post

    i want to find an element based on its hierarchy. so i am using the AddHierarchyConstraint method of HtmlFindExpression as follows:

     

    HtmlFindExpression oldExpr = new HtmlFindExpression("TagName=table" class ="xmlMenuCellSpacing");

    HtmlFindExpression expr = new HtmlFindExpression("TagName=td");
    expr.AddHierarchyConstraint(new HierarchyConstraint(new HtmlFindExpression("TagName=a", "TextContent="+item.ToClauseString()), 1));

    oldExpr .AppendChain(expr);

     

    But when i am appending the hierarchy constraints exprression to some old expression chain. The new expression lost the hierarchy constraint after AppendChain() call. I need a long chain of expression with hierarchy constraints .

    Should it be a bug or you only allow hierarchy constraints in a single expression not in a chained expression.  

    I have attached the scenario i am working on . There i need to find a cell(td) which have <a> anchor tag with text content as "Layout" whose parent(grandparent or so on..) is a cell (td) which have <a> anchor tag with text content as "Window" which have a parent (grant parent or so on..) is a table (table) with class =xmlMenuCellSpacing.

    Please let me know what are the possible way of achieving the above said scenario.

  2. Vinay
    Vinay avatar
    16 posts
    Member since:
    Jan 2015

    Posted 03 Jun 2015 Link to this post

    Anyone there for help?
  3. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 05 Jun 2015 Link to this post

    Hello,

    You can use this article as a starting point.


    Regards,
    Ivaylo
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top