Find.ByExpression to find Sibling elements

4 posts, 0 answers
  1. Derek
    Derek avatar
    2 posts
    Member since:
    May 2015

    Posted 16 Sep 2015 Link to this post

    So I have something like this:

     

    <div class="X">

         <div class="pK">

         <div class = "Z">

               <i class="Target">

    pK is what identifies the whole element, this is the only unique thing and I know it going in but that's all I know except that I want to click on i="Target", child of sibling of parent with div class="pK"

    So...

    Find.ByExpression("class=X", "with child of", "class=pK", "|", "class=Z", "|", "class=Target" )

    I think that's where the piece I am missing would go.  Or could I nest them web elements somehow?



    Thanks,
    Derek


  2. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 21 Sep 2015 Link to this post

    Hello Derek,

    Here is an useful article about chained find expressions.

    Regarding the find expression that you are looking for, please try the following:

    tagname=div,class=X,|,tagname=div,class=Z,|,tagname=i,class=Target

    Hope it works for you.

    Regards,
    Ivaylo
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  3. Derek
    Derek avatar
    2 posts
    Member since:
    May 2015

    Posted 22 Sep 2015 in reply to Ivaylo Link to this post

    I think I was not clear.  Your expression here totally ignores the "pK" value, which is the only value in the entire chain off of the first DIV, this pattern exists 100 times on the page but I only want 1 of them and the only way to identify the one I want is by the "pK" value.

    This expression just generically finds the "Target", this will return 100 targets instead of 1.

    What I am working on now is a loop, iterate through the TagIndex for the top level Div in this example, then search if for the "pk", then once I find it construct an expression using the Iterator variable from the loop to jump directly to that Div tag index.

    However, this is going to be excruciatingly slow and I don't have it working yet.  Any superior solution is welcomed.


    Derek

     

  4. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 25 Sep 2015 Link to this post

    Hello Derek,

    The only way we can provide more complicated and superior scenario is to have access to the control in question.

    With the example provided this is the proper way of finding the target element.

    Regards,
    Ivaylo
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top