Hi James, Thanks for the reply.
Got it to work... I've added gotoRootWindow(); after selectOption(); This somehow gets the current page. Seems that the current page is not being retrieved automatically after the selectOption is executed by jWebUnit. This might be a bug or a feature. If it's a feature, it might be useful to add it to the manual just in case people encounter the same situation, although I hope it can be done automatically. Cheers! ----- Original Message ----- From: "James E Weaver" <[EMAIL PROTECTED]> To: "Kristoffer Chua" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, October 19, 2004 2:53 AM Subject: Re: [Jwebunit-users] Javascript submit not working for me > Hiya, > > Well, I think this one's javascript rather than bug. You should be getting > an HttpUnit error somewhere - "undefined value has no properties". Maybe > that's getting supressed somewhere. > > In any case it's this snippet that I think is causing the problem : > "document.myform.submit()". I don't think rhino will process that syntax. > Try "document.forms[0].submit()" or "document.forms['myform'].submit()". > Either one of those should do the job. > > Now, I'm not sure how it could work in your HttpUnit example either - cause > it's an HttpUnit thing. I may be missing something. There's a testcase in > the source tree though, which runs sucessfully, that's pretty much doing > exactly what your example does - it's JavaScriptEventsTest. You may be > able to get some insight on the problem by running / tweaking that unit > test. > > Jim > > Jim Weaver > Software Developer - ThoughtWorks > Office : 615-850-4724 > Cell : 312-286-7496 > > > > "Kristoffer Chua" > <[EMAIL PROTECTED] > vebusiness.com> To > Sent by: <[EMAIL PROTECTED] > jwebunit-users-ad et> > [EMAIL PROTECTED] cc > orge.net > Subject > [Jwebunit-users] Javascript submit > 10/13/2004 02:46 not working for me > AM > > > > > > > > > > I'm not submitting this as a bug yet, as I'm not sure if I just missed a > step or something... > > My html has a javascript that calls submit when select is changed: > <html> > <form name="myform" action="http://www.yahoo.com"> > <select name="names" onChange="document.myform.submit();"> > <option value="All">All</option> > <option value="None">None</option> > </select> > </form> > </html> > > My JWebunit Test follows: > public void testHtml() throws Exception { > getTestContext().setBaseUrl("http://localhost:8080/myapp"); > beginAt("try.html"); > dumpResponse(System.out); > selectOption("names","None"); > dumpResponse(System.out); > } > > Output is wrong: > <html> > <form name="myform" action="http://www.yahoo.com"> > <select name="names" onChange="document.myform.submit();"> > <option value="All">All</option> > <option value="None">None</option> > </select> > </form> > </html> > <html> > <form name="myform" action="http://www.yahoo.com"> > <select name="names" onChange="document.myform.submit();"> > <option value="All">All</option> > <option value="None">None</option> > </select> > </form> > </html> > > > JwebUnit Using HttpUnitDialog > public void testHtml2() throws Exception { > getTestContext().setBaseUrl(MainTest.URL); > beginAt("try.html"); > dumpResponse(System.out); > hud=getDialog(); > resp=hud.getResponse(); > form=resp.getForms()[0]; > form.setParameter("names","None"); > resp=getTestContext().getWebClient().getCurrentPage(); > System.out.println(resp.getText()); > > } > Output is correct. > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IT Product Guide on ITManagersJournal > Use IT products in your business? Tell us what you think of them. Give us > Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more > http://productguide.itmanagersjournal.com/guidepromo.tmpl > _______________________________________________ > Jwebunit-users mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jwebunit-users > > ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ Jwebunit-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jwebunit-users
