Interesting, there is a similar discussion on StackOverflow:

http://stackoverflow.com/questions/680241/reset-form-with-jquery

On Wed, Jul 21, 2010 at 1:36 PM, Jian Fang <[email protected]> wrote:

> Wow, that is very efficient way to clear up the form. I will add a reset()
> method to the Form object.
>
> His idea to search for UI module may have other use cases as well and thus,
> we may need both.
>
> Thanks,
>
> Jian
>
>
>
> On Wed, Jul 21, 2010 at 1:24 PM, Jonathan Share <[email protected]>wrote:
>
>> Wouldn't the original use case "to clear out the values of all of the
>> text fields" be better served by implementing a reset method on the
>> Form UI Object that calls the javascript Form.reset() method?
>>
>> https://developer.mozilla.org/en/DOM/form.reset
>>
>> On 21 July 2010 18:45, Jian Fang <[email protected]> wrote:
>> > From: Jian Fang <[email protected]>
>> > Date: Wed, Jul 21, 2010 at 12:43 PM
>> > Subject: Re: Which UI Module is the current one?
>> > To: Jade <[email protected]>
>> >
>> >
>> > You mean you want to find UIDs from the UI Module object by specifying
>> some
>> > constraints such as
>> > ID list? Good idea, seems we should add couple findBy_ methods. I will
>> think
>> > about that.
>> >
>> > In the meanwhile, there is a method getUiByTag to get back UIDs from
>> runtime
>> > DOM, i.e., create some temporal UI object in the dom
>> > so that you can reference them just like a regular UI object.
>> >
>> > UiByTagResponse getUiByTag(String tag, Map filters)
>> >
>> > after the work is done, you need to clear them up with the following
>> method
>> >
>> > void removeMarkedUids(String tag)
>> >
>> > But your idea of providing search methods over the UI Module, not the
>> > Runtime DOM is great.
>> >
>> > Thanks,
>> >
>> > Jian
>> >
>> > On Wed, Jul 21, 2010 at 12:20 PM, Jade <[email protected]> wrote:
>> >>
>> >> Hi Jian,
>> >>
>> >> I fixed the error that Jonathan pointed out and all the tests pass.
>> >> Thank you both for spending the time to look through my code!
>> >>
>> >> In the process, I looked at the Container class that you mentioned and
>> >> that helped me find another error.
>> >>
>> >> I'd like to clear out the values of all of the text fields in between
>> >> the tests.
>> >>
>> >> However, this method is giving me a UiObjectNotFoundException because
>> >> getAllFields is returning the id's of the elements.
>> >>
>> >> String[] inputFieldIds = getAllFields();
>> >>                // This is causing an error: Cannot find UI Object
>> >>                for (String fieldId : inputFieldIds) {
>> >>                        clearText(fieldId)
>> >>                        pause pauseTime
>> >>                }
>> >>
>> >>  error message: Cannot find UI Object
>> >> aspect_vireo_submit_VerifyPersonalInformation_field_middleInitial in
>> >> PersonalInformationForm.
>> >>
>> >> Since clearText expects the uid (not the id) of the element, I get an
>> >> error.
>> >>
>> >> Is there a method for getting the uid from an id of an element? It
>> >> would be awesome to have a version of the getAll____ methods that
>> >> return the uids instead of the ids.
>> >>
>> >> Jade
>> >>
>> >>
>> >> On Jul 21, 8:58 am, Jian Fang <[email protected]> wrote:
>> >> > Most likely, the error message is thrown by the walkTo method in
>> >> > Container
>> >> > class of Tellurium core.
>> >> >
>> >> > public UiObject walkTo(WorkflowContext context, UiID uiid){
>> >> >
>> >> >         //if not child listed, return itself
>> >> >         if(uiid.size() < 1){
>> >> >             if(this.locator != null){ // && this.useGroupInfo
>> >> >                 groupLocating(context)
>> >> >                 context.noMoreProcess = true;
>> >> >             }
>> >> >
>> >> >             return this
>> >> >         }
>> >> >
>> >> >         String child = uiid.pop()
>> >> >
>> >> >         //otherwise, try to find its child
>> >> >         UiObject cobj = components.get(child)
>> >> >
>> >> >         //if found the object
>> >> >         if(cobj != null){
>> >> >             //update reference locator by append the relative locator
>> >> > for
>> >> > this container
>> >> >             if(this.locator != null){
>> >> >                 groupLocating(context)
>> >> >
>> >> >             }
>> >> >             if(uiid.size() < 1){
>> >> >                 //not more child needs to be found
>> >> >                 return cobj
>> >> >             }else{
>> >> >                 //recursively call walkTo until the object is found
>> >> >                 return cobj.walkTo(context, uiid)
>> >> >             }
>> >> >         }else{
>> >> >
>> >> >             //cannot find the object
>> >> >
>> >> >             println
>> i18nBundle.getMessage("Container.CannotFindUIObject"
>> >> > ,
>> >> > child , this.uid) <--this line
>> >> >
>> >> >             return null
>> >> >         }
>> >> >     }
>> >> >
>> >> > Seems it tried to find UI Object
>> >> > "PersonalInformationForm.LicenseAgreement"
>> >> > but could not find, do you have another
>> >> > container "PersonalInformationForm" over the "LicenseAgreement"
>> object?
>> >> >
>> >> > Could you do me a favor to put a breakpoint to the line I indicated
>> >> > above
>> >> > and look at the content of the passed in variable "UiID uiid"?
>> >> >
>> >> > Jonathan, did you have a similar problem?
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Jian
>> >> >
>> >> > On Tue, Jul 20, 2010 at 3:37 PM, Jade <[email protected]> wrote:
>> >> > > Thanks for your quick reply Jonathan. The stacktrace is:
>> >> >
>> >> > > org.telluriumsource.exception.UiObjectNotFoundException: Cannot
>> find
>> >> > > UI Object LicenseAgreement.GoToPersonalInformation
>> >> > >         at
>> >> > > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>> >> > > Method)
>> >> > >        at
>> >> >
>> >> > >
>> >> > >
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:
>> >> > > 39)
>> >> > >        at
>> >> >
>> >> > >
>> >> > >
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:
>> >> > > 27)
>> >> > >        at
>> >> > > java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>> >> > >        at
>> >> >
>> >> > >
>> >> > >
>> org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:
>> >> > > 77)
>> >> > >         at org.codehaus.groovy.runtime.callsite.ConstructorSite
>> >> > >
>> $ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:
>> >> > > 107)
>> >> > >        at
>> >> >
>> >> > >
>> >> > >
>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:
>> >> > > 52)
>> >> > >        at
>> >> >
>> >> > >
>> >> > >
>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:
>> >> > > 192)
>> >> > >        at
>> >> >
>> >> > >
>> >> > >
>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:
>> >> > > 200)
>> >> > >        at
>> >> >
>> >> > >
>> >> > >
>> org.telluriumsource.dsl.BaseDslContext.walkToWithException(BaseDslContext.groovy:
>> >> > > 155)
>> >> > >        at org.telluriumsource.dsl.BaseDslContext
>> >> > > $walkToWithException.callCurrent(Unknown Source)
>> >> > >        at
>> >> >
>> >> > >
>> >> > >
>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:
>> >> > > 44)
>> >> > >        at org.telluriumsource.dsl.BaseDslContext
>> >> > > $walkToWithException.callCurrent(Unknown Source)
>> >> > >        at
>> >> >
>> >> > >
>> >> > >
>> org.telluriumsource.dsl.BaseDslContext.isElementPresent(BaseDslContext.groovy:
>> >> > > 471)
>> >> > >        at
>> >> >
>> >> > >
>> >> > >
>> test.StudentSubmissionJUnitTestCase.returnToPersonalInformationPage(StudentSubmissionJUnitTestCase.java:
>> >> > > 141)
>> >> > >        at
>> >> >
>> >> > >
>> >> > >
>> test.StudentSubmissionJUnitTestCase.testFillOutPersonalInformation(StudentSubmissionJUnitTestCase.java:
>> >> > > 104)
>> >> > >        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.junit.runners.model.FrameworkMethod
>> >> > > $1.runReflectiveCall(FrameworkMethod.java:44)
>> >> > >        at
>> >> >
>> >> > >
>> >> > >
>> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:
>> >> > > 15)
>> >> > >        at
>> >> >
>> >> > >
>> >> > >
>> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:
>> >> > > 41)
>> >> > >        at
>> >> >
>> >> > >
>> >> > >
>> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:
>> >> > > 20)
>> >> > >        at
>> >> >
>> >> > >
>> >> > >
>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:
>> >> > > 76)
>> >> > >        at
>> >> >
>> >> > >
>> >> > >
>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:
>> >> > > 50)
>> >> > >        at
>> org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
>> >> > >        at
>> >> > > org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
>> >> > >        at
>> >> > > org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
>> >> > >        at
>> >> > > org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
>> >> > >        at
>> >> > > org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
>> >> > >        at
>> >> > >
>> >> > >
>> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:
>> >> > > 28)
>> >> > >        at
>> >> > >
>> >> > >
>> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:
>> >> > > 31)
>> >> > >        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
>> >> > >        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)
>> >> >
>> >> > > Here are snippets of the calling Junit Test and Module methods:
>> >> >
>> >> > >    /**
>> >> > >     * Fill out page 1 of the student submission and press Submit.
>> >> > >     */
>> >> > >    @Test
>> >> > >    public void testFillOutPersonalInformation() {
>> >> > >        spim.doResetForm();
>> >> > >        // Select the first non-empty option/value pair from each
>> >> > > selection
>> >> > > list
>> >> > >        // and verify that it's selected.
>> >> >
>> >> > >        TestingUtils.selectFirstValidOption(collegeId, spim);
>> >> > >        TestingUtils.selectFirstValidOption(departmentId, spim);
>> >> > >        TestingUtils.selectFirstValidOption(degreeId, spim);
>> >> > >        TestingUtils.selectFirstValidOption(disciplineId, spim);
>> >> >
>> >> > >        spim.doFillOutForm("M", "1987", "999-999-9999",
>> >> > >                "101 Permanent Address Austin, TX 78704",
>> >> > > "[email protected]
>> >> > > ",
>> >> > >                "888-888-8888", "101 Current Address Austin, TX
>> >> > > 78704");
>> >> >
>> >> > >        spim.click("PersonalInformationForm.Submit");
>> >> > >        spim.waitForPageToLoad(30000);
>> >> > >        assertTrue(
>> >> > >                "LicenseAgreement page hasn't loaded. Personal
>> >> > > Information
>> >> > > probably
>> >> > > has an error.",
>> >> > >                slam.isElementPresent("LicenseAgreement.Submit"));
>> >> >
>> >> > >        returnToPersonalInformationPage();   // this is where the
>> error
>> >> > > begins. Page one is correct so page 2 (license agreement) has
>> loaded.
>> >> >
>> >> > >    }
>> >> >
>> >> > >  /**
>> >> > >     * We're on the license agreement page. Click on the input image
>> >> > > to return
>> >> > >     * to the personal information page.
>> >> > >     */
>> >> > >    private void returnToPersonalInformationPage() {
>> >> > >        System.out.println("returnToPersonalInformationPage title: "
>> >> > >                + spim.getTitle());
>> >> > >        if
>> >> > > (spim.isElementPresent("LicenseAgreement.GoToPersonalInformation"))
>> {
>> >> > >            spim.click("LicenseAgreement.GoToPersonalInformation");
>> >> > >            spim.waitForPageToLoad(30000);
>> >> > >            spim.waitForElementPresent(collegeId, 30000);
>> >> >
>> >> > >        }
>> >> > >        System.out.println("returnToPersonalInformationPage title: "
>> >> > >                + spim.getTitle());
>> >> > >    }
>> >> >
>> >> > > Here's some of the output from the console:
>> >> >
>> >> > > TE: Found exact match for UI Module 'LicenseAgreement':
>> >> > > {"id":"LicenseAgreement","relaxDetails":[],"matches":
>> >> > > 1,"relaxed":false,"score":100.0,"found":true}
>> >> > > TE: Found exact match for UI Module 'LicenseAgreement':
>> >> > > {"id":"LicenseAgreement","relaxDetails":[],"matches":
>> >> > > 1,"relaxed":false,"score":100.0,"found":true}
>> >> > > TE: Name: getTitle, start: 1279654077983, duration: 14ms
>> >> > > TE: Name: getTitle, start: 1279654077983, duration: 14ms
>> >> > > returnToPersonalInformationPage title: License Agreement
>> >> > > Cannot find UI Object LicenseAgreement in PersonalInformationForm
>> >> >
>> >> > > Note that the StudentLicenseAgreementModule contains the InputBox:
>> >> > > GoToPersonalInformation
>> >> >
>> >> > > public class StudentLicenseAgreementModule extends DslContext {
>> >> > >        public void defineUi() {
>> >> >
>> >> > >                // Page two: license agreement
>> >> > >                ui.Form(uid: "LicenseAgreement", clocator: [tag:
>> >> > > "form",
>> >> > > method:
>> >> > > "post", action: "/vireo101/vireo", class: "ds-interactive-div", id:
>> >> > > "aspect_vireo_submit_LicenseAgreement_div_licenseAgreement"]){
>> >> > >                        CheckBox(uid: "Agree", clocator: [tag:
>> "input",
>> >> > > type: "checkbox",
>> >> > > value: "agree", name: "agree"])
>> >> >
>> >> > >                        InputBox(uid: "GoToPersonalInformation",
>> >> > > clocator:
>> >> > > [tag: "input",
>> >> > > type: "image", value: "Verify Info", title: "Verify User Data:
>> Viewed
>> >> > > Step", name: "step_one", class: "ds-button-field vireo_step one",
>> id:
>> >> > > "aspect_vireo_submit_LicenseAgreement_field_step_one"], respond:
>> >> > > ["mouseOut", "mouseOver", "click"])
>> >> > >                        SubmitButton(uid: "Submit", clocator: [tag:
>> >> > > "input",
>> >> > > type:
>> >> > > "submit", value: "Agree and Continue>>", name: "saveAndContinue",
>> >> > > class: "ds-button-field", id:
>> >> > > "aspect_vireo_submit_LicenseAgreement_field_saveAndContinue"])
>> >> > >                }
>> >> > >        }
>> >> >
>> >> > > I don't know if I need to include more containers around the html
>> >> > > elements. I removed most of them.
>> >> >
>> >> > > BTW, I got it working by defining a new module that includes forms
>> >> > > from multiple pages but I'd prefer not to do this if possible.
>> Thus,
>> >> > > if you have any information to share about your
>> >> >
>> >> > ...
>> >> >
>> >> > read more ยป
>> >
>> >
>> > --
>> > 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]<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.

Reply via email to