Rohanh,

Good question. The direct children came from the old mode that we use
header + object's xpath + trailer.
But this mode is really not flexible because it has hard-coded xpath
there. As a result, it is a bit
depreciated now. As long as all the List elements on the same sub-tree
related to its parent, you are fine to
use not direct children there. As a matter of fact, if you look at the
generated locator for List without separator,
they are descendants instead of direct children.

I will apply your change there and commit the code soon.

Thanks,

Jian

On May 5, 6:48 pm, rohanh <[email protected]> wrote:
> I have the following html structure which I wish to represent as a
> List of repeating groups:
>
> <div id="main">
> <span>User blah</span>
>
> <form method="post">
>       <div id="cols">
>              <div id="col1">
>                   <table>
>                        <tr>
>                               ...
>                                content
>                               ...
>                        </tr>
>                    </table>
>                   <table>
>                          <tr>
>                               ...
>                                content
>                               ...
>                          </tr>
>                   </table>
>              </div>
>              <div id="col2">
>                    <table>
>                          <tr>
>                             ...
>                              content
>                             ...
>                           </tr>
>                    </table>
>                    <table>
>                          <tr>
>                            ...
>                              content
>                            ...
>                          </tr>
>                    </table>
>              </div>
>       </div>
>       ...
> </form>
> </div>
>
> The "content"  is the same for each table row ( a link and a checkbox,
> plus some other stuff I dont care about ). I have no control of the
> html I am testing so at this stage I cannot change it to be more
> suitable for tellurium. And I dont really care about the layout or
> positioning of the elements I wish to test, all I want is to able to
> easily traverse a list and click the links or checkboxes. I though I
> would be able to do something like the following:
>
> ui.Container(uid: "MainContent",  clocator: [tag: "div", id: "main"],
> group: "true") {
>        TextBox(uid: "User"        , clocator: [tag: "span"])
>           Form(uid: "NetworkSubscriptionForm"    , clocator: [method:
> "post"]) {
>             List(uid: "List"          , clocator: [tag: "div", id:
> "cols"], separator: "tr") {
>                    Container(uid: "all" ) {
>                       CheckBox(uid: "Subscribe", clocator: [tag:
> "input, type: "checkbox"] )
>                        UrlLink(uid: "Name"     , clocator: [href: "^/
> networks/"])
>                     }
>             }
>             SubmitButton(uid: "Submit"       , clocator: [name:
> "send_submit"])
>         }
>
> }
>
> However, it seems the Abstract List Containers "separator" is expected
> to be a direct descendant of the List clocator so this did not work..
> Is there a technical reason for forcing the separator to be a direct
> descendant?
>
> To test a theory, I changed the following code so that the direct
> descendant restriction was lifted for the separator. It gave the
> results I was after. This would allow a more flexible referencing of
> items in tables and repeating patterns with a common ancestor. It
> should still allow the intended scenarios for lists to work ( I
> think ) Can you see any problems with this approach?
>
> Index: core/src/main/groovy/org/tellurium/object/List.groovy
> ===================================================================
> --- core/src/main/groovy/org/tellurium/object/List.groovy       (revision
> 1596)
> +++ core/src/main/groovy/org/tellurium/object/List.groovy       (working
> copy)
> @@ -129,7 +129,7 @@
>      if (separator == null || separator.trim().size() == 0)
>          return deriveListSelector(index)
>
> -        return " > " + separator + ":eq(${index-1})"
> +          return " " + separator + ":eq(${index-1})"
>  }
>
>  int getListSize(Closure c) {
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tellurium-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/tellurium-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to