Thanks for the update....That sounds good. 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 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 >> >> ... >> >> 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 -~----------~----~----~----~------~----~------~--~---
