Rohan,

Sorry, the invisible tbody, "trailer", is due to a bug. I just fixed
it and please update
from Maven repo for 0.6.0.

The trailer should be xpath, thus, in your UI module you should use

List(uid: "Fields"  , clocator: [tag: "table", trailer:"/tbody"],
separator: "tr")

Be aware that the header and the trailer attributes in a UI object
must
be an xpath expression and Tellurium Core will automatically transform
that
into a jQuery expression if you use jQuery selector.

The subtle difference between separator and non-separator can be
illustrated by the following example

      ui.List(uid: "A", clocator: [tag: "table", trailer: "/tbody"],
separator: "tr") {
        InputBox(uid: "1", clocator: [:])
        Selector(uid: "2", clocator: [:])
        TextBox(uid: "all", clocator: [tag: "div"])
      }

      ui.List(uid: "B", clocator: [tag: "table", trailer: "/tbody/
tr"]) {
        InputBox(uid: "1", clocator: [:])
        Selector(uid: "2", clocator: [:])
        TextBox(uid: "all", clocator: [tag: "div"])
      }

Then, run dump("A") and dump("B"), you will get

Dump locator information for A
-------------------------------------------------------
A: //descendant-or-self::table/tbody
A[1]: //descendant-or-self::table/tbody/tr[1]/descendant-or-
self::input
A[2]: //descendant-or-self::table/tbody/tr[2]/descendant-or-
self::select
A[3]: //descendant-or-self::table/tbody/tr[3]/descendant-or-self::div
-------------------------------------------------------


Dump locator information for B
-------------------------------------------------------
B: //descendant-or-self::table/tbody/tr
B[1]: //descendant-or-self::table/tbody/tr/input[1]
B[2]: //descendant-or-self::table/tbody/tr/select[1]
B[3]: //descendant-or-self::table/tbody/tr/div[1]
-------------------------------------------------------


Dump locator information for A
-------------------------------------------------------
A: jquery=table > tbody
A[1]: jquery=table > tbody > tr:eq(0) input
A[2]: jquery=table > tbody > tr:eq(1) select
A[3]: jquery=table > tbody > tr:eq(2) div
-------------------------------------------------------


Dump locator information for B
-------------------------------------------------------
B: jquery=table > tbody > tr
B[1]: jquery=table > tbody > tr > input:eq(0)
B[2]: jquery=table > tbody > tr > select:eq(0)
B[3]: jquery=table > tbody > tr > div:eq(0)
-------------------------------------------------------

which means the elements of a List without separator must be direct
children
so that we can count the index for a specific tag, for example,

B[4] --> table > tbody > tr > div:eq(1)

With separator, the index would be on the separator, i.e., tr.

A[4]: jquery=table > tbody > tr:eq(3) div

Also, if you want to use a logical Container, you should remove the
clocator: [:], and
just use

  Container(uid: "all" ) {
  }

You cannot use the logical Container without the separator because the
logic
Container does not have a tag and there is no way for Tellurium to
count the
index of a List element.

Thanks,

Jian

On May 16, 7:13 pm, Rohan Holt <[email protected]> wrote:
> Hi Jian,
>
> JQuery seems to need the invisible "tbody" when direct descendent ">"
>
> I think it would need to be "> div > table > tbody > tr"
>
> So in order to model a table as a list of rows would I use the  
> following:
>
>              List(uid: "Fields"  , clocator: [tag: "table", trailer:  
> "tbody"], separator: "tr") {
>                  Container(uid: "all" , clocator: [:]) {
>                         InputBox(uid: "textarea", clocator: [tag:  
> "textarea"])
>                         InputBox(uid: "item"       , clocator: [:])
>                         Selector(uid: "selector" , clocator: [:])
>                }
>
> and, would removing the separator and changing trailer to "tbody/
> tr"  ( i.e List(uid: "Fields", clocator: [tag: "table"], trailer:  
> "tbody/tr"]) be the same?
>
> HTML
>
> <table>
>    <tr>
>      <td><strong>Test Attribute Five:</strong></td>
>      <td></td>
>      <td><input  name="TestAttribute5" type="text" size="30"  
> value=""></td>
>    </tr>
>    <tr>
>      <td><strong>Test Attribute Six:</strong></td>
>      <td></td>
>      <td><input  name="TestAttribute6" type="text" size="30"  
> value=""></td>
>    </tr>
>    <tr>
>      <td><strong>Test Selector 1:</strong></td>
>      <td></td>
>      <td valign=middle>
>          <select  name="TestSelector1">
>              <option value="" SELECTED></option>
>              <option value="1" >One</option>
>              <option value="2" >Two</option>
>              <option value="3" >Three</option>
>              <option value="4" >Four</option>
>          </select>
>      </td>
>    </tr>
> </table>
>
> Rohan
>
> On 9 May 2009, at 05:07, John wrote:
>
>
>
> > Hi, Rohanh,
>
> > After think about it twice, I need to restrict the separator to be
> > direct child.
> > The reason is that if the separator is a descendant, then it is almost
> > impossible
> > to locate the separator since the number of List elements could be
> > zero
> > or any number, you cannot really reply on List element to help to
> > locate the separator.
> > Also, to specify direct: "true" for all List elements looks really
> > urgly.
>
> > However, to achieve some degree of flexiblity for the List object, I
> > would allow
> > you to use the trailer attribute for the List object, which is an
> > xpath, for example, in your original
> > html (The table one), you can use separator "tr" and trailer "/div/
> > table".
> > Tellurium will automatically translate them into "> div > table > tr"
> > if you use
> > jQuery selector. In this way, it really likes an one dimension table.
>
> > This also solves the similar problem for the second use case of the
> > List object,
> > i.e., all List elements are siblings, but do not have a separator.
> > This scenario is worse than
> > the first one because there is even no separator there and you do not
> > really know what
> > the runtime elements would be. Impossible to locate them. As a result,
> > you should also
> > use the trailer attribute for the List. With that, in your second
> > example, you should not
> > define separator and trailer for the List object because they are both
> > empty.
>
> > Would this sound good for you? I am going to refactor the List object
> > in this way.
>
> > Thanks,
>
> > Jian
>
> > On May 8, 1:20 am, John <[email protected]> wrote:
> >> Your html really shows the second use case of List, i.e., all element
> >> do not have
> >> a shared separator, but are siblings. Note that the TextBox has the
> >> "div" tag on itself, thus,
> >> cannot have another div before it as the separator.
>
> >> Seems I fixed the extra div and direct child issues. I used your
> >> second UI module
> >> and run the dump() method
>
> >> public class UserProfileList extends DslContext {
> >>   public void defineUi() {
> >>     ui.Container(uid: "MainPanel2", clocator: [tag: "div", id:
> >> "main"]) {
> >>       List(uid: "UserProfileDetails", clocator: [tag: "div",
> >>               class: "myBox"]) {
> >>         TextBox(uid: "1", clocator: [tag: "div",
> >>                 direct: "true"])
> >>         Container(uid: "all", clocator: [tag: "div",
> >>                 direct: "true"]) {
> >>           TextBox(uid: "Name", clocator: [tag: "div",
> >>                   direct: "true", position: "1"])
> >>           TextBox(uid: "Value", clocator: [tag: "div",
> >>                   direct: "true", position: "2"])
> >>         }
> >>       }
> >>     }
> >>   }
>
> >> }
>
> >>       UserProfileList upl = new UserProfileList();
> >>       upl.defineUi();
> >>       upl.useJQuerySelector();
> >>       upl.dump("MainPanel2")
>
> >> get the following output,
>
> >> Dump locator information for MainPanel2
> >> -------------------------------------------------------
> >> MainPanel2: jquery=#main
> >> MainPanel2.UserProfileDetails: jquery=#main div.myBox
> >> MainPanel2.UserProfileDetails[1]: jquery=#main div.myBox > div:eq(0)
> >> MainPanel2.UserProfileDetails[2]: jquery=#main div.myBox > div:eq(1)
> >> MainPanel2.UserProfileDetails[2].Name: jquery=#main div.myBox >  
> >> div:eq
> >> (1) > div:eq(0)
> >> MainPanel2.UserProfileDetails[2].Value: jquery=#main div.myBox >  
> >> div:eq
> >> (1) > div:eq(1)
> >> -------------------------------------------------------
>
> >> See how handy the dump() method is.
>
> >> I checked in the code and updated the Maven repo, please update your
> >> tellurium core jar.
>
> >> Still working on the getListSize() issue.
>
> >> Thanks,
>
> >> Jian
>
> >> On May 7, 8:49 pm, rohanh <[email protected]> wrote:
>
> >>> John,
>
> >>> Am still having some problems with Lists. I think I must be doing
> >>> something wrong but I cant figure it out..
>
> >>> Take for example the following html fragment
>
> >>> <div id=main>
> >>>  ...
> >>>  <div class=myBox>
> >>>     <div id=heading>Personal Details</div>
> >>>     <div>
> >>>         <div>Address</div>
> >>>         <div>Somewhere 1, Somewhere 1, London, SW13EY</div>
> >>>     </div>
> >>>     <div>
> >>>         <div>Tel</div>
> >>>         <div>1111111111</div>
> >>>     </div>
> >>>     <div>
> >>>         <div>Email</div>
> >>>         <div><a href="mailto:test...@somewhere";>test...@somwhere</
> >>> a></
> >>> div>
> >>>     </div>
> >>>     <div>
> >>>         <div>Mobile</div>
> >>>         <div>1111111111</div>
> >>>     </div>
> >>>  </div>
> >>> </div>
>
> >>> And the model. (NOTE: I am not sure I have used the position  
> >>> attribute
> >>> correctly below)
>
> >>> ui.Container(uid: "MainPanel", clocator: [tag: "div", id: "main"]){
> >>>         List(uid: "UserProfileDetails"     ,clocator: [tag:  
> >>> "div"   ,
> >>> class: "myBox"], separator: "div") {
> >>>                 TextBox(uid:"1"            ,clocator: [tag: "div"])
> >>>                 Container(uid: "all"       ,clocator: [tag:  
> >>> "div"]) {
> >>>                     TextBox(uid: "Name"    ,clocator: [tag: "div",
> >>> position: "1"])
> >>>                     TextBox(uid: "Value"     ,clocator: [tag: "div",
> >>> position: "2"])
> >>>                 }
> >>>         }
>
> >>> }
>
> >>> Anyway, before the recent change to List.groovy, getListSize
> >>> ("MainPanel.UserProfileDetails") would have reported "5"
> >>> After, the change, it will report "13" as separator "div" will match
> >>> all descendant divs. That's ok I though
> >>> ,as I can remove the separator and use direct: "true" on the List
> >>> content objects, like the following:
>
> >>> ui.Container(uid: "MainPanel", clocator: [tag: "div", id: "main"]){
> >>>         List(uid: "UserProfileDetails"     ,clocator: [tag:  
> >>> "div"   ,
> >>> class: "myBox"]) {
> >>>                 TextBox(uid:"1"            ,clocator: [tag:  
> >>> "div"   ,
> >>> direct: "true"])
> >>>                 Container(uid: "all"       ,clocator: [tag:  
> >>> "div"   ,
> >>> direct: "true"]) {
> >>>                     TextBox(uid: "Name"    ,clocator: [tag:  
> >>> "div"   ,
> >>> direct: "true", position: "1"])
> >>>                     TextBox(uid: "Value"   ,clocator: [tag:  
> >>> "div"   ,
> >>> direct: "true", position: "2"])
> >>>                 }
> >>>         }
>
> >>> }
>
> >>> I would have expected getListSize("MainPanel.UserProfileDetails") to
> >>> return "5" now
>
> >>> But instead the logs show:
>
> >>> 01:10:31.563 INFO - Command request: getListSize[jquery=#main
> >>> div.myBox, div,div] on session ec03ffac789e4013a4adadc82f38a7eb
> >>> 01:10:31.586 INFO - Got result: OK,13 on session
> >>> ec03ffac789e4013a4adadc82f38a7eb
> >>> 01:10:31.618 INFO - Command request: getText[jquery=#main div.myBox
> >>> div:eq(1) > div > div:eq(0), ] on session
> >>> ec03ffac789e4013a4adadc82f38a7eb
> >>> 01:10:31.655 INFO - Got result: ERROR: Element jquery=#main  
> >>> div.myBox
> >>> div:eq(1) > div > div:eq(0) not found on session
> >>> ec03ffac789e4013a4adadc82f38a7eb
>
> >>> It looks to me like the direct: "true" attribute is being ignored  
> >>> for
> >>> list contents.
> >>> Also I am curious about the generated jquery for getText
> >>> ("MainPanel.UserProfileDetails[2].Name")...it has more div children
> >>> that I would have expected..
>
> >>> The correct jquery string should be:  #main div.myBox > div:eq(1) >
> >>> div:eq(0)
>
> >>> Am I doing something wrong?
>
> >>> Thanks
> >>> Rohan
>
> >>> On May 6, 3:05 am, John <[email protected]> wrote:
>
> >>>> 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
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
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