Thanks John.

   Sorry I should have sent out a mail confirming that the method works in both 
instances (XPath and JQuery).

Regards,

Manoj


>
>From: Jian Fang <[email protected]>
>To: [email protected]
>Sent: Monday, July 20, 2009 8:55:24 PM
>Subject: Re: getAttribute() question.
>
>>I used the html you provided and the UI module you defined
>
>   public class ListModule extends DslContext {
>     public void defineUi() {
>       ui.Container(uid: "rotator", clocator: [tag: "div", class: 
> "thumbnails"]) {
>>         List(uid: "tnails", clocator: [tag: "ul"], separator: "li") {
>           UrlLink(uid: "all", clocator: [:])
>         }
>       }
>     }  
>}
>
>The following test code generated the result you wanted for both xpath and 
>jquery.
>
>public class ListTestCase  extends TelluriumJavaTestCase {
>@Test
>    public void testGetSeparatorAttribute(){
>        ListModule lm = new ListModule();
>        lm.defineUi();
>        connectUrl("http://localhost:8080/list.html";);
>>        lm.disableJQuerySelector();
>        String attr = (String)lm.getParentAttribute("rotator.tnails[6]", 
> "class");
>        System.out.println("XPath: Class attribute for rotator.tnails[6] " + 
> attr);
>>        lm.useJQuerySelector();
>        attr = (String)lm.getParentAttribute("rotator.tnails[6]", "class");
>        System.out.println("jQuery: Class attribute for rotator.tnails[6] " + 
> attr);
>>    }
>}
>
>The output is as follows,
>
>22:45:58.837 INFO - Got result: OK on session a33ea57aeefd4076a47d9df118494b7a
>22:45:59.006 INFO - Command request: open[http://localhost:8080/list.html, ] 
>on session a33ea57aeefd4076a47d9df118494b7a
>>22:45:59.150 INFO - Got result: OK on session a33ea57aeefd4076a47d9df118494b7a
>22:45:59.308 INFO - Command request: 
>getAttribute[//descendant-or-self::d...@class="thumbnails"]/descendant-or-self::ul/li[6]/self::node()@class,
> ] on session a33ea57aeefd4076a47d9df118494b7a
>>22:45:59.327 INFO - Got result: OK,thumbnail potd on session 
>>a33ea57aeefd4076a47d9df118494b7a
>XPath: Class attribute for rotator.tnails[6] thumbnail potd
>22:45:59.398 INFO - Command request: getAttribute[jquery=div.thumbnails ul > 
>li:eq(5)@class, ] on session a33ea57aeefd4076a47d9df118494b7a
>>22:45:59.418 INFO - Got result: OK,thumbnail potd on session 
>>a33ea57aeefd4076a47d9df118494b7a
>jQuery: Class attribute for rotator.tnails[6] thumbnail potd
>
>As a result, the getParentAttribute should work for you. 
>
>Thanks,
>
>Jian
>
>
>On Mon, Jul 20, 2009 at 6:36 PM, Jian Fang <[email protected]> wrote:
>
>>>Sorry, it proved that I had a bad test case. I updated the method and 
>>>redeployed it to Maven repo. Please update from Maven repo 
>>and run the test again. Since I don't have a good test web at hand, please 
>>test both xpath and jquery selector for me.
>>
>>Thanks in advance,
>>
>>Jian
>>
>>
>>
>>
>>On Mon, Jul 20, 2009 at 6:04 PM, Jian Fang <[email protected]> wrote:
>>
>>Please check if your UI module is fine, i.e., if  "rotator.tnails[6]" could 
>>be found . I tested on xpath and it seems working. Will check in the test 
>>code later.
>>>
>>>Thanks,
>>>
>>>Jian
>>>
>>>
>>>
>>>>>>On Mon, Jul 20, 2009 at 5:51 PM, Manoj Chavan <[email protected]> 
>>>>>>wrote:
>>>
>>>Sorry.. here is the entire exception...
>>>>
>>>>
>>>>
>>>>com.thoughtworks.selenium.SeleniumException: ERROR: Element 
>>>>//descendant-or-self::d...@class="thumbnails"]/descendant-or-self::ul/li[6]/descendant-or-self::a/parent::node()
>>>> not found
>>>>>>>>
>>>>
>>>>    at 
>>>> com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
>>>>    at 
>>>> com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
>>>>>>>>
>>>>
>>>>    at 
>>>> com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:262)
>>>>    at 
>>>> com.thoughtworks.selenium.DefaultSelenium.getAttribute(DefaultSelenium.java:495)
>>>>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>> Method)
>>>>    at 
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>    at 
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>    at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>>
>>>>
>>>>    at 
>>>> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
>>>>    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
>>>>    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1061)
>>>>>>>>
>>>>
>>>>    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:892)
>>>>    at 
>>>> groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:142)
>>>>    at groovy.lang.MetaObjectProtocol$invokeMethod.call(Unknown Source)
>>>>>>>>
>>>>
>>>>    at org.tellurium.dispatch.Dispatcher.invokeMethod(Dispatcher.groovy:26)
>>>>    at
>>>> org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:46)
>>>>    at 
>>>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:43)
>>>>    at 
>>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>>>>>>>>
>>>>
>>>>    at 
>>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
>>>>    at org.tellurium.access.Accessor.getAttribute(Accessor.groovy:190)
>>>>    at org.tellurium.access.Accessor$getAttribute.call(Unknown Source)
>>>>>>>>
>>>>
>>>>    at 
>>>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:43)
>>>>    at 
>>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>>>>    at 
>>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
>>>>>>>>
>>>>
>>>>    at
>>>> org.tellurium.dsl.BaseDslContext$_getParentAttribute_closure79.doCall(BaseDslContext.groovy:1093)
>>>>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>    at 
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>>
>>>>
>>>>    at 
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>    at java.lang.reflect.Method.invoke(Method.java:597)
>>>>    at 
>>>> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
>>>>>>>>
>>>>
>>>>    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
>>>>    at 
>>>> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
>>>>    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:892)
>>>>>>>>
>>>>
>>>>    at
>>>> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:39)
>>>>    at 
>>>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:43)
>>>>    at 
>>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>>>>>>>>
>>>>
>>>>    at 
>>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
>>>>    at org.tellurium.object.UiObject.getAttribute(UiObject.groovy:117)
>>>>    at org.tellurium.object.UiObject$getAttribute.call(Unknown Source)
>>>>>>>>
>>>>
>>>>    at 
>>>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:43)
>>>>    at 
>>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>>>>    at 
>>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
>>>>>>>>
>>>>
>>>>    at
>>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callSafe(AbstractCallSite.java:96)
>>>>    at 
>>>> org.tellurium.dsl.BaseDslContext.getParentAttribute(BaseDslContext.groovy:1088)
>>>>    at test.BRHomePageTestCase.testRotatorWidget(BRHomePageTestCase.java:76)
>>>>
>>>>
>>>>>
>>>>>From: Jian Fang <[email protected]>
>>>>>To: [email protected]
>>>>>Sent: Monday, July 20, 2009 2:46:27 PM
>>>>>Subject: Re: getAttribute() question.
>>>>>
>>>>>
>>>>>>>>>>Yes.
>>>>>
>>>>>
>>>>>On Mon, Jul 20, 2009 at 5:10 PM, Manoj Chavan <[email protected]> 
>>>>>wrote:
>>>>>
>>>>>Is this new method in the 0.7.0-SNAPSHOT ?
>>>>>>
>>>>>>Manoj
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>From: Jian Fang <[email protected]>
>>>>>>>To: [email protected]
>>>>>>>Sent: Monday, July 20, 2009 2:04:41 PM
>>>>>>>Subject: Re: getAttribute() question.
>>>>>>>
>>>>>>>
>>>>>>>>>>>>>>I added a general method
>>>>>>>
>>>>>>>def getParentAttribute(String uid, String attribute)
>>>>>>>
>>>>>>>to get back the parent attribute for any UI element. In your case 
>>>>>>>
>>>>>>>getParentAttribute("rotator.tnails[6]", "class") 
>>>>>>>
>>>>>>>should return the separator attribute. This method should be able to be 
>>>>>>>used for any other UI elements as well.
>>>>>>>I haven't tested it, please check out the new 0.7.0 core artifact from 
>>>>>>>our Maven repo and help us to test if it works
>>>>>>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>for you. Please let me know the result.
>>>>>>>
>>>>>>>Thanks,
>>>>>>>
>>>>>>>Jian
>>>>>>>
>>>>>>>
>>>>>>>On Mon, Jul 20, 2009 at 4:45 PM, Jian Fang <[email protected]> 
>>>>>>>wrote:
>>>>>>>
>>>>>>>Usually, "rotator.tnails[6]" refers to the List element, not the 
>>>>>>>separator. I will a new method for you to access
>>>>>>>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>the attribute for the List separator tonight. Will let you know after I 
>>>>>>>>check in the code.
>>>>>>>>
>>>>>>>>>>>>>>>>Thanks,
>>>>>>>>
>>>>>>>>Jian
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>On Mon, Jul 20, 2009 at 3:49 PM, Manoj Chavan <[email protected]> 
>>>>>>>>wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>>>>>>>>>>>My Source:
>>>>>>>>>
>>>>>>>>>>>>>>>>>><div class="thumbnails">
>>>>>>>>>>>>>>>>>><ul>
>>>>>>>>>>>>>>>>>><li class="thumbnail">
>>>>>>>>>>>>>>>>>><img alt="Dan Henderson Ruins UFC's Hopes For UFC 105 and 
>>>>>>>>>>>>>>>>>>Michael Bisping" 
>>>>>>>>>>>>>>>>>>src="/images_root/image_pictures/0518/0180/127482_crop_85x60.jpg"/>
>>>>>>>>>>>>>>>>>></li>
>>>>>>>>>>>>>>>>>><li class="thumbnail">
>>>>>>>>>>>>>>>>>><img alt="Underdog Sports: Best Pro Women Athletes Today No. 
>>>>>>>>>>>>>>>>>>10-6" 
>>>>>>>>>>>>>>>>>>src="/images_root/image_pictures/0517/9892/98173_crop_85x60.jpg"/>
>>>>>>>>>>>>>>>>>></li>
>>>>>>>>>>>>>>>>>><li class="thumbnail">
>>>>>>>>>>>>>>>>>><img alt="The Chicago Cubs: My First MLB Game Pt.2; The Magic 
>>>>>>>>>>>>>>>>>>Of Hatfeild Hotdogs!" 
>>>>>>>>>>>>>>>>>>src="/images_root/image_pictures/0517/9210/100722_crop_85x60.jpg"/>
>>>>>>>>>>>>>>>>>></li>
>>>>>>>>>>>>>>>>>><li class="thumbnail">
>>>>>>>>>>>>>>>>>></li>
>>>>>>>>>>>>>>>>>><li class="thumbnail active">
>>>>>>>>>>>>>>>>>><img alt="Boston Red Sox Weekly Recap (Week 15)" 
>>>>>>>>>>>>>>>>>>src="/images_root/image_pictures/0518/0204/6839_crop_85x60.jpg"/>
>>>>>>>>>>>>>>>>>></li>
>>>>>>>>>>>>>>>>>><li class="thumbnail potd">
>>>>>>>>>>>>>>>>>><div class="potd-icon png-fix"/>
>>>>>>>>>>>>>>>>>><img alt="Browns Fans Want To See More Of Jerome Harrison, 
>>>>>>>>>>>>>>>>>>You're Getting Your Wish" 
>>>>>>>>>>>>>>>>>>src="/images_root/image_pictures/0517/9916/111034_crop_85x60.jpg"/>
>>>>>>>>>>>>>>>>>></li>
>>>>>>>>>>>>>>>>>></ul>
>>>>>>>>>>>>>>>>>></div>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>>>>>>>>>// My Module Def:
>>>>>>>>>>>>>>>>>>         ui.Container(uid:"rotator", 
>>>>>>>>>>>>>>>>>> clocator:[tag:"div",class:"thumbnails"]){
>>>>>>>>>>>>>>>>>>             List(uid: "tnails", clocator: [tag: "ul"], 
>>>>>>>>>>>>>>>>>> separator: "li"){
>>>>>>>>>>>>>>>>>>                 UrlLink(uid: "all", clocator: [:])
>>>>>>>>>>>>>>>>>>             }
>>>>>>>>>>>>>>>>>>         }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>>>>>>>>>I want to get the attribute of the [6] element.
>>>>>>>>>
>>>>>>>>>>>>>>>>>>getAttribute("rotator.tnails[6]", "class")   gives me no 
>>>>>>>>>>>>>>>>>>element exception
>>>>>>>>>
>>>>>>>>>>>>>>>>>>How do I define the module so that I get back the string 
>>>>>>>>>>>>>>>>>>"thumbnail potd"
>>>>>>>>>
>>>>>>>>>>>>>>>>>>Any help pointer appreciated. Thank you.
>>>>>>>>>
>>>>>>>>>>>>>>>>>>Manoj
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>
>
>>>
>
--~--~---------~--~----~------------~-------~--~----~
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