Runtime XPath generation and getListSize

0 views
Skip to first unread message

d32

unread,
Feb 9, 2010, 7:12:07 AM2/9/10
to tellurium-users
Hi Jian,

We have few querries regarding the XPath generated at the runtime and
getListSize method.

Html:
<div id="div1">
............
............
<div id="div2">
..............
.............
<ul>//list1
<li>
<ul>//list 2
<li></li>
</ul>
</li>
<li></li>
</ul>

</div>

</div>

UIModule:

ui.Container(uid:"div1", clocator:[tag:"div", id:"div1"]) {

Div(uid:"div2", clocator:[id:"div2"])

List(uid:"list1", clocator:[tag:"ul"], separator:"li")
{
Container(uid:"all")
{
List(uid:"list2", clocator:[tag:"ul"], separator:"li"){
}
}

}//end list1

}//end div2
}//end div1

For UID div1.div2.list1 following xpath is generated
//descendant-or-self::div[@id="div1"]/descendant-or-self::ul

Shouldn't it include second div also like:
//descendant-or-self::div[@id="div1"]/descendant-or-
self::div[@id="div2"]/descendant-or-self::ul

what if there is list between div1 and div2, according to the xpath
generated it will process that list instead of list1.

if xpath had also include div2 this wont happen.

Please advice us why this is happening (exclusion of div2 from the
xpath)

Second query:
when we use getListSize(div1.div2.list1) it returns 3 (size of list1 +
size of list 2)
As per our understanding when we say size of a list it should include
LIs for that list only, it should not include nested list.

you could add another method that gives the size of a list excluding
nested lists.


Please advice us on the same.

Best regards,
Prashant Dhaka

Jian Fang

unread,
Feb 9, 2010, 9:31:22 AM2/9/10
to telluri...@googlegroups.com
Hi,

I will create a test case to re-produce your problem and see what happens.

BTW, is the waitForPageToLoad problem resolved?

Thanks,

Jian


--
You received this message because you are subscribed to the Google Groups "tellurium-users" group.
To post to this group, send email to telluri...@googlegroups.com.
To unsubscribe from this group, send email to tellurium-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/tellurium-users?hl=en.


Jian Fang

unread,
Feb 9, 2010, 5:15:26 PM2/9/10
to telluri...@googlegroups.com
Hi,

Seems your UI module is not correct. The Div is not a container type object, you should use Container instead.
Since Tellurium ui object is an abstract object, there is really no need to define a separate a Div object. Perhaps
we should remove the Div object from Tellurium core.

Here is the UI module I used

class DListModule extends DslContext {
  public void defineUi(){

    ui.Container(uid: "div1", clocator: [tag: "div", id: "div1"]) {
      Container(uid: "div2", clocator: [id: "div2"]) {

        List(uid: "list1", clocator: [tag: "ul"], separator: "li")
                {
                  Container(uid: "all")
                          {
                            List(uid: "list2", clocator: [tag: "ul"], separator: "li") {
                            }
                          }
                }//end list1
      }//end div2
    }//end div1
  }
}

The Test case is simple as follows.

class DListModule_UT extends GroovyTestCase {

  public void testDump(){
    DListModule dlm = new DListModule();
    dlm.defineUi();
    dlm.dump("div1");
    dlm.dump("div1.div2.list1");
  }
}

The output is as follows,
Dump locator information for div1
-------------------------------------------------------
div1: //descendant-or-self::div[@id="div1"]
div1.div2: //descendant-or-self::div[@id="div1"]/descendant-or-self::*[@id="div2"]
div1.div2.list1: //descendant-or-self::div[@id="div1"]/descendant-or-self::*[@id="div2"]/descendant-or-self::ul
div1.div2.list1[1]: //descendant-or-self::div[@id="div1"]/descendant-or-self::*[@id="div2"]/descendant-or-self::ul/li[1]
div1.div2.list1[1].list2: //descendant-or-self::div[@id="div1"]/descendant-or-self::*[@id="div2"]/descendant-or-self::ul/li[1]/descendant-or-self::ul
div1.div2.list1[1].list2[1]: //descendant-or-self::div[@id="div1"]/descendant-or-self::*[@id="div2"]/descendant-or-self::ul/li[1]/descendant-or-self::ul/li[1]
-------------------------------------------------------

Dump locator information for div1.div2.list1
-------------------------------------------------------
div1.div2.list1: //descendant-or-self::div[@id="div1"]/descendant-or-self::*[@id="div2"]/descendant-or-self::ul
div1.div2.list1[1]: //descendant-or-self::div[@id="div1"]/descendant-or-self::*[@id="div2"]/descendant-or-self::ul/li[1]
div1.div2.list1[1].list2: //descendant-or-self::div[@id="div1"]/descendant-or-self::*[@id="div2"]/descendant-or-self::ul/li[1]/descendant-or-self::ul
div1.div2.list1[1].list2[1]: //descendant-or-self::div[@id="div1"]/descendant-or-self::*[@id="div2"]/descendant-or-self::ul/li[1]/descendant-or-self::ul/li[1]
-------------------------------------------------------

Let me know if this works for you.

Thanks,

Jian

d32

unread,
Mar 16, 2010, 2:29:21 AM3/16/10
to tellurium-users
Hi Jian,

Soory for late reply, I was on break and joined the office today only.

Thanks for the help.

Our UI module was correct, its typo that i did instead of Container I
typed DIV, again soory for this.

We are facing some unusual issues, I'll prepare the consolidated list
of issues and will post soon.

Thanks again.
Prashant

> On Tue, Feb 9, 2010 at 9:31 AM, Jian Fang <john.jian.f...@gmail.com> wrote:
> > Hi,
>
> > I will create a test case to re-produce your problem and see what happens.
>
> > BTW, is the waitForPageToLoad problem resolved?
>
> > Thanks,
>
> > Jian
>

> >> tellurium-use...@googlegroups.com<tellurium-users%2Bunsu...@googlegroups.com>

Jian Fang

unread,
Mar 16, 2010, 4:05:01 PM3/16/10
to telluri...@googlegroups.com
What are the issues then?

To unsubscribe from this group, send email to tellurium-use...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages