Good catch, Jonathan. Thanks,
Jian On Wed, Jul 21, 2010 at 10:08 AM, Jonathan Share <[email protected]>wrote: > Jian, it's a lot simpler than that... Jade's code calls > spim.isElementPresent("LicenseAgreement.GoToPersonalInformation") > where spim is the StudentPersonalInformationModule, however it is the > StudentLicenseAgreementModule that has defined the LicenseAgreement > form. So the fix is for Jade to call > slam.isElementPresent("LicenseAgreement.GoToPersonalInformation"). > There is no bug in the Tellurium code here, it's working exactly as it > should. > > Regards, > > Jonathan > > On 21 July 2010 15:58, 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 set up, that would be > >> very helpful. > >> > >> Jade > >> > >> On Jul 20, 2:09 pm, Jonathan Share <[email protected]> wrote: > >> > I'm doing something similar and this works flawlessly. > >> > isElementPresent really shouldn't be throwing an exception. Can you > >> > email the stacktrace you are getting? > >> > > >> > Regards, > >> > > >> > Jonathan > >> > > >> > On 20 July 2010 18:48, Jade <[email protected]> wrote: > >> > > >> > > We have a 5 page submission form. I'd like to test page one with > many > >> > > different values before moving on to testing page two. Thus, I have > >> > > one test that fills out the form with valid data. After the submit > >> > > button is pressed, the second page is loaded. The test then clicks > on > >> > > a link in the second page to return to the first page and clear and > >> > > form and retest with different values. > >> > > >> > > I'd like to verify that a certain page has loaded. However, if the > >> > > page hasn't loaded, the moduleName.isElementPresent() throws an > >> > > exception. Is there a way to get the name of the current module > that's > >> > > loaded? > >> > > >> > > BTW, our test class loads in both modules during setup: > >> > > >> > > @BeforeClass > >> > > public static void initUi() { > >> > > spim = new StudentPersonalInformationModule(); > >> > > spim.defineUi(); > >> > > >> > > slam = new StudentLicenseAgreementModule(); > >> > > slam.defineUi(); > >> > > >> > > connectUrl("http://localhost:8000/vireo101/vireo/start"); > >> > > } > >> > > >> > > 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 > >> > > athttp://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]<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.
