Seems you should use

org.junit.Assert.assertTrue(
yshp.isElementPresent("cuponmod.mod.body.data[" + i + "].list[" + j +
"].merchant"));


On Fri, Oct 30, 2009 at 7:22 PM, Manoj Chavan <[email protected]>wrote:

> I wrote a method in the UI def but am getting exception.
>
> public int getTabCount(){
>         return getListSize("cuponmod.mod.body.data")
> }
>
> public int getCouponCount(int x){
>         return getListSize("cuponmod.mod.body.data["+ x +"].list")
> }
>
> I call it like this
>
> public void testCuponModule(){
>         for(int i= 1; i <= yshp.getTabCount(); i++){
>             for(int j= 1; j <= yshp.getCouponCount(i); j++){
>
> org.junit.Assert.assertTrue(yshp.isElementPresent("cuponmod.mod.body.data[i].list[j].merchant"));
>
> org.junit.Assert.assertTrue(yshp.isElementPresent("cuponmod.mod.body.data[i].list[j].title"));
>
> org.junit.Assert.assertTrue(yshp.isElementPresent("cuponmod.mod.body.data[i].list[j].exp"));
>             }
>         }
>     }
>
>
>
> I am getting the following exception.  Is the syntax correct in the method?
>
> java.lang.NumberFormatException: For input string: "i"
>
>     at java.lang.NumberFormatException.forInputString(Unknown Source)
>     at java.lang.Integer.parseInt(Unknown Source)
>     at java.lang.Integer.parseInt(Unknown Source)
>     at java_lang_Integer$parseInt.call(Unknown Source)
>     at org.tellurium.object.List.walkTo(List.groovy:221)
>     at org.tellurium.object.List$walkTo.call(Unknown Source)
>     at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
>     at org.tellurium.object.Container$walkTo.call(Unknown Source)
>     at org.tellurium.object.Container.walkTo(Container.groovy:97)
>     at org.tellurium.object.Container$walkTo.call(Unknown Source)
>     at org.tellurium.object.Container.walkTo(Container.groovy:97)
>     at org.tellurium.object.Container$walkTo.call(Unknown Source)
>     at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
>     at org.tellurium.object.List$walkTo.call(Unknown Source)
>     at org.tellurium.object.Container.walkTo(Container.groovy:97)
>     at org.tellurium.object.Container$walkTo.call(Unknown Source)
>     at org.tellurium.dsl.UiDslParser.walkTo(UiDslParser.groovy:68)
>     at org.tellurium.dsl.UiDslParser$walkTo.call(Unknown Source)
>     at
> org.tellurium.dsl.BaseDslContext.walkToWithException(BaseDslContext.groovy:207)
>     at
> org.tellurium.dsl.BaseDslContext$walkToWithException.callCurrent(Unknown
> Source)
>     at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44)
>     at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:143)
>     at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:155)
>     at
> org.tellurium.dsl.BaseDslContext.isElementPresent(BaseDslContext.groovy:459)
>     at
> com.yahoo.shopping.TestHomePage.testCuponModule(TestHomePage.java:37)
>
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>     at java.lang.reflect.Method.invoke(Unknown Source)
>     at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
>     at
> org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
>     at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
>     at
> org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
>     at
> org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
>     at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
>     at
> org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
>     at
> org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
>     at
> org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
>     at
> org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
>     at
> org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
>     at
> org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
>     at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
>     at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>
>
>
> *From:* Manoj Chavan <[email protected]>
>
> *To:* [email protected]
> *Sent:* Fri, October 30, 2009 3:52:25 PM
>
> *Subject:* Re: Nested List - Module def question?
>
> Thanks. That worked. The more and more I use Tellurium am falling ins love
> with it
> and am advocating its use in my group :)  keep up the great work.
>
> Regards,
>
> Manoj
>
>
> *From:* Jian Fang <[email protected]>
> *To:* [email protected]
> *Sent:* Fri, October 30, 2009 3:46:10 PM
> *Subject:* Re: Nested List - Module def question?
>
> body.data[2].list[1].merchant
>
> On Fri, Oct 30, 2009 at 6:43 PM, Manoj Chavan <[email protected]>wrote:
>
>> So how would i get the value ?
>>
>> body.data[2].list[1].merchant ? OR
>> body.data[2].all.list[1].merchant?
>>
>> A little confusing. Thank you for the pointers.
>>
>> Regards,
>>
>> Manoj
>>
>>
>> *From:* Jian Fang <[email protected]>
>> *To:* [email protected]
>> *Sent:* Fri, October 30, 2009 3:32:19 PM
>> *Subject:* Re: Nested List - Module def question?
>>
>> Up to now, List and Table only support index as in template. We do have
>> plan to support more general template definitions, but it takes some time to
>> achieve that because that requires fundamental changes to the List and the
>> Table object.
>>
>> For your case, you should use "all" as the template uid inside the List,
>> i.e.,
>>
>> Container(uid:"body", clocator:[tag:"div", class:"bd"]){
>>                List(uid: "data", clocator: [tag: "div",
>> class:"scrolling"]){
>>                    Container(uid: "all", clocator: [tag:"div",
>> class:"tabcont"]){
>>                        List(uid: "list", clocator: [tag: "ul"], separator:
>> "li"){
>>                            Container(uid:"all", clocator:[:]){
>>                                UrlLink(uid: "merchant", clocator: [tag:
>> "a" , class:"merchant"])
>>                                UrlLink(uid: "title", clocator: [tag: "a" ,
>> class:"title"])
>>                                UrlLink(uid: "exp", clocator: [tag: "a" ,
>> class:"exp"])
>>                            }
>>                        }
>>                    }
>>                }
>>
>> Please let us know if this helps or not.
>>
>> Thanks,
>>
>> Jian
>>
>> On Fri, Oct 30, 2009 at 5:17 PM, Manoj Chavan <[email protected]>wrote:
>>
>>>
>>> Hi,
>>>
>>>  I have the following HTML. and the related Module Def I scripted. Wanted
>>> to validate
>>> it. If I try "getValue("body.data.tabs[2].list.details[1].merchant"
>>> should return "Merchant21".
>>> Is my syntax correct? Is it possible to have this type of nested list
>>> structure. I need to
>>> use this cause the list is dynamic and can change anytime.
>>>
>>> Regards,
>>>
>>> Manoj
>>>
>>>
>>> <div class="bd">
>>>    <div class="scrolling" style="margin-left: 0px;">
>>>        <div class="tabcont selected">
>>>            <ul>
>>>                <li>
>>>                    <p class="merchant">Merchant11</p>
>>>                    <p class="title">Title11</p>
>>>                    <p class="exp">12/30/09</p>
>>>                </li>
>>>                <li></li>
>>>                <li></li>
>>>                <li></li>
>>>            </ul>
>>>        </div>
>>>        <div class="tabcont">
>>>            <ul>
>>>                <li>
>>>                    <p class="merchant">Merchant21</p>
>>>                    <p class="title">Title121</p>
>>>                    <p class="exp">12/30/09</p>
>>>
>>>                </li>
>>>                <li></li>
>>>                <li></li>
>>>                <li></li>
>>>            </ul>
>>>        </div>
>>>        <div class="tabcont">
>>>        </div>
>>>    </div>
>>> </div>
>>>
>>>
>>>
>>> Container(uid:"body", clocator:[tag:"div", class:"bd"]){
>>>                List(uid: "data", clocator: [tag: "div",
>>> class:"scrolling"]){
>>>                    Container(uid: "tabs", clocator: [tag:"div",
>>> class:"tabcont"]){
>>>                        List(uid: "list", clocator: [tag: "ul"],
>>> separator: "li"){
>>>                            Container(uid:"details", clocator:[:]){
>>>                                UrlLink(uid: "merchant", clocator: [tag:
>>> "a" , class:"merchant"])
>>>                                UrlLink(uid: "title", clocator: [tag: "a"
>>> , class:"title"])
>>>                                UrlLink(uid: "exp", clocator: [tag: "a" ,
>>> class:"exp"])
>>>                            }
>>>                        }
>>>                    }
>>>                }
>>>            }
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>>
>
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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