Another option, that I use a lot would be to model the multiple
occurrences of the FieldTermWidget as a List or a Repeat (note: Repeat
is not officially documented yet, but search the archives of this list
for how to use).
Your model would look something like this;
ui.Repeat(uid: 'FieldTermWidget', clocator: [tag: 'div', class:
'field-widget'], group: 'true') {
InputBox(uid: 'Input', clocator: [class: 'form-text', type:
'text'])
Button(uid: 'Edit', clocator: [tag: 'button', type: 'button'])
}
Then you can use it in your test as follows;
def count = getRepeatNum('FieldTermWidget')
count.times { it ->
def index = it + 1
println getValue("FieldTermWidget[${index}].Input")
}
You can do a very similar trick with a List but then you need
everything to have one common parent element.
Hope this helps,
Jonathan
On 26 April 2010 17:55, Jian Fang <[email protected]> wrote:
> We postponed support of variable definition in udl due to the deadline.
> Otherwise, you
> can specify the id attribute when you create an new instance for it.
>
> Tellurium widget might be a solution for you if you define the id attribute
> at the widget level.
> I will create a sample for you if I have some free time tonight.
>
> Thanks,
>
> Jian
>
> On Mon, Apr 26, 2010 at 2:17 AM, recursv <[email protected]> wrote:
>>
>> I am trying to define a custom UI Module which is reused many times on
>> a single page and I can't figure out how to use the module in my
>> tests.
>>
>> I am trying to test the values for a generated form. The form contains
>> many TermWidget's which all have the same structure and differ only by
>> unique ids.
>> so I have a TermWidget defined as
>>
>> ui.Container(uid: 'FieldTermWidget', clocator: [tag: 'div', class:
>> 'field-widget'], group: 'true') {
>> InputBox(uid: 'Input', clocator: [class: 'form-text', type:
>> 'text'])
>> Button(uid: 'Edit', clocator: [tag: 'button', type: 'button'])
>> }
>>
>> What I would like to do is implement a getText(String htmlID) method
>> to test the values for each generated TermWidget. I've been through
>> the documentation and I didn't pick it up from there.. I get that I
>> have to update the locator 'id' attribute with the desired value but
>> how is this achieved? Does one use the DslContext.getUiElement() and
>> then modify the locator for the Container object and then something or
>> should I be trying to contruct a UI Object Builder which generates
>> objects of this sort and binding it to the ui object somehow...
>>
>> A link in the right direction much appreciated.
>> Thanks,
>>
>> --
>> 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.
>>
>
> --
> 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.
>
--
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.