Hi Jade,
Why you need to use List for a selector? Shouldn't the Selector object
satisfy your need?
That is to say, your UI module could be like
ui.Form(uid: "DegreeInformationForm", clocator: [tag:
"form", method: "post", action: "${postAction}", class:
"ds-interactive-divview-form", id: "aspect_vireo_admin_View_div_view-form"])
{
Selector(uid: "degree", clocator:
[id:"aspect_vireo_admin_View_field_degree" ]
}
Then you could call selectByLabel, selectByValue, or selectByIndex.
Thanks,
Jian
On Mon, Aug 30, 2010 at 12:24 PM, Jade <[email protected]> wrote:
> Hi,
>
> We have an ajax powered list that is clickable. In order to manipulate
> the list, the user first selects it. This replaces the "fake HTML"
> with select list HTML.
>
> However, the list has a json parse error until I remove the respond:
> ["click"] option. But, then the list cannot be clicked and manipulated
> in the code.
>
> Here's the module as I'd like to define it:
> String postAction = "\"${VireoTestConfig.getWebApp()}/vireo/admin/
> detail?update=true\""
>
> public void defineModule() {
> ui.Form(uid: "DegreeInformationForm", clocator: [tag:
> "form",
> method: "post", action: "${postAction}", class: "ds-interactive-div
> view-form", id: "aspect_vireo_admin_View_div_view-form"]) {
> List(uid: "degree", clocator: [tag: "select", id:
> "aspect_vireo_admin_View_field_degree"], separator: "option", respond:
> ["click"]) {
> Container(uid: "{all}", clocator: [:])
> }
> }
>
>
> ERROR: Command execution failure. Please search the Tellurium User
> Group at http://groups.google.com/group/tellurium-users for error
> details from the log window. The error message is: JSON.parse
>
> com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:
> 97)
>
>
> com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:
> 91)
> sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
>
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 43)
> java.lang.reflect.Method.invoke(Method.java:616)
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite
> $PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:
> 229)
>
>
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:
> 52)
>
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 129)
>
>
> org.telluriumsource.component.connector.CustomSelenium.getBundleResponse(CustomSelenium.groovy:
> 257)
> sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
>
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 43)
> java.lang.reflect.Method.invoke(Method.java:616)
>
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> 88)
> groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
>
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1058)
>
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
>
> groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:
> 149)
> groovy.lang.MetaObjectProtocol$invokeMethod.call(Unknown
> Source)
>
>
> org.telluriumsource.component.dispatch.Dispatcher.methodMissing(Dispatcher.groovy:
> 56)
> sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)
>
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 43)
> java.lang.reflect.Method.invoke(Method.java:616)
>
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> 88)
>
> groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:
> 813)
>
> groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:
> 1107)
>
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1060)
>
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
>
>
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:
> 39)
>
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 129)
>
>
> org.telluriumsource.component.bundle.BundleProcessor.passBundledCommand(BundleProcessor.groovy:
> 322)
> org.telluriumsource.component.bundle.BundleProcessor
> $passBundledCommand.callCurrent(Unknown Source)
>
>
> org.telluriumsource.component.bundle.BundleProcessor.process(BundleProcessor.groovy:
> 414)
> org.telluriumsource.component.bundle.BundleProcessor
> $process.callCurrent(Unknown Source)
>
>
> org.telluriumsource.component.bundle.BundleProcessor.methodMissing(BundleProcessor.groovy:
> 427)
> sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
>
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 43)
> java.lang.reflect.Method.invoke(Method.java:616)
>
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> 88)
>
> groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:
> 813)
>
> groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:
> 1107)
>
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1060)
>
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
>
> groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:
> 149)
> groovy.lang.MetaObjectProtocol$invokeMethod.call(Unknown
> Source)
>
>
> org.telluriumsource.component.custom.Extension.methodMissing(Extension.groovy:
> 20)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 57)
>
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 43)
> java.lang.reflect.Method.invoke(Method.java:616)
>
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> 88)
>
> groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:
> 813)
>
> groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:
> 1107)
>
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1060)
>
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
>
>
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:
> 39)
>
>
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> 40)
>
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 117)
>
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 129)
>
>
> org.telluriumsource.dsl.BaseDslContext.getUiModuleValidationResult(BaseDslContext.groovy:
> 1417)
> org.telluriumsource.dsl.BaseDslContext
> $getUiModuleValidationResult.callCurrent(Unknown Source)
>
>
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:
> 44)
>
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:
> 143)
>
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:
> 151)
>
> org.telluriumsource.dsl.BaseDslContext.validate(BaseDslContext.groovy:
> 1404)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 57)
>
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 43)
> java.lang.reflect.Method.invoke(Method.java:616)
>
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> 88)
> groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
>
>
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:
> 362)
>
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
>
>
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:
> 66)
>
>
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:
> 44)
>
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:
> 143)
>
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:
> 151)
>
> org.tdl.vireo.webtest.datadriventests.module.admin.DegreeInformationModule
> $_defineModule_closure14.doCall(DegreeInformationModule.groovy:128)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> Here's the output of dump:
>
> DegreeInformationForm: jquery=#aspect_vireo_admin_View_div_view-form
> DegreeInformationForm.degree:
> jquery=#aspect_vireo_admin_View_field_degree
> DegreeInformationForm.degree[2]:
> jquery=#aspect_vireo_admin_View_field_degree > option:eq(1)
> -------------------------------------------------------
> Here's the output of toString:
>
> [{"obj":{"uid":"DegreeInformationForm","locator":
> {"tag":"form","attributes":{"id":"aspect_vireo_admin_View_div_view-
> form","action":"xmlui/vireo/admin/detail?update=true","class":"ds-
> interactive-div view-
> form","method":"post"}},"uiType":"Form","metaData":
>
> {"id":"DegreeInformationForm","type":"UiObject"}},"key":"DegreeInformationForm"},
> {"obj":{"uid":"degree","locator":{"tag":"select","attributes":
> {"id":"aspect_vireo_admin_View_field_degree"}},"events":
> [Ljava.lang.String;@58f41393
> ,"uiType":"List","separator":"option","metaData":
> {"id":"degree","type":"UiObject"}},"key":"DegreeInformationForm.degree"},
> {"obj":{"uid":"_all","locator":{},"uiType":"Container","metaData":
> {"id":"_all","index":
>
> {"value":"all","type":"VAL"},"type":"List"}},"key":"DegreeInformationForm.degree._all"}]
>
> Diagnosis Result for DegreeInformationForm.degree
>
> When I remove the respond: ["click"] code, then the list can't be
> clicked and the list size is 0:
>
> 1)
>
> testDataDriven(org.tdl.vireo.webtest.datadriventests.test.admin.DegreeInformationTest)
> java.lang.AssertionError: 1 > list, DegreeInformationForm.degree,
> size: 0
> at org.junit.Assert.fail(Assert.java:91)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 57)
> at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 43)
> at java.lang.reflect.Method.invoke(Method.java:616)
> at
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> 88)
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
> at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite
> $StaticMetaMethodSiteNoUnwrap.invoke(StaticMetaMethodSite.java:130)
> at
>
> org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.callStatic(StaticMetaMethodSite.java:
> 99)
> at
>
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:
> 48)
> at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:
> 167)
> at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:
> 175)
> at
>
> org.tdl.webtest.utils.TestingUtils.selectClickableOption(TestingUtils.groovy:
> 112)
> at org.tdl.webtest.utils.TestingUtils
> $selectClickableOption.call(Unknown Source)
> at
>
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> 40)
> at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 117)
> at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 137)
> at
> org.tdl.vireo.webtest.datadriventests.module.admin.DegreeInformationModule
> $_defineModule_closure15.doCall(DegreeInformationModule.groovy:151)
>
> Here's the piece of the code that fails:
> public static void selectClickableOption(final String listUid,
> final DslContext module, final int indx, boolean shouldFail) {
>
> String elementId;
> // With Ajax, the module has to be clicked on so the uid is
> found.
> //module.click listUid
>
> int len = module.getListSizeBySelector(listUid)
> if (indx > len) {
> fail("${indx} > list, ${listUid}, size: ${len}")
> }
>
>
> Jade
>
> --
> 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]<tellurium-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/tellurium-users?hl=en.
>
>
--
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.