Hi Monika, Sorry for the delay. Are you really using JWebUnit? Your examples seem to prove you are using HtmlUnit. In this case, you should ask HtmlUnit mailing list.
I you are using JWebUnit, here is a sample test that works fine on my computer: public class MyTest extends WebTestCase { public void testMonika() { URL page1 = this.getClass().getResource("/Page1.html"); beginAt(page1.toExternalForm()); assertTitleEquals("Page 1"); clickLink("link1_on_page1"); gotoWindow("lengendWin"); assertTitleEquals("Page 2"); clickLink("closeme"); assertTitleEquals("Page 1"); } } You can fine the full sources as an attachement (rename extension as .zip). ++ Julien ----- Message d'origine ---- De : Monika Monika <[EMAIL PROTECTED]> À : Usage problems for jWebUnit <jwebunit-users@lists.sourceforge.net> Envoyé le : Jeudi, 18 Janvier 2007, 20h09mn 38s Objet : Re: [JWebUnit-users] [Jwebunit-users] Re : problem with javascript:window.close() Hi, Thanks for your consideration!!! Well i tried a little bit of search for this problem, got the idea of what it is doing.. but i am not clear with on thing, for which i am sending you a bit of code : from first page my script : <script type="text/javascript"> function newWindow(){ legendWindow = window.open('LogonTest.jsp', 'lengendWin', 'width=800,height=760,resizable=yes'); } </script> and anchor tag from where i am calling : <TR> <TD COLSPAN=2> <a href="javascript:newWindow()" name="testAnchor" id="link1_on_page1" >hello check this out</a> </TD> </TR> Okey now my test statement : final HtmlPage page2 = (HtmlPage) ((HtmlAnchor) page.getHtmlElementById("link1_on_page1")).click(); -> works perfectly fine Now my second page : <script type="text/javascript"> <!-- function newWindow(){ legend = self.close() } //--> </script> calling anchor tag : <a href="javascript:newWindow()" id="closeme" >close this window</a> and test case : STATEMENT 1 : -----> ((HtmlAnchor) page2.getHtmlElementById("closeme")).click(); Now if i create class of WebWindowListener and try to grab the expected event with event occured then assert condition is true. In testcase class: STATEMENT 2 : --> Object expectedWindowEvent = new WebWindowEvent(secondWin, WebWindowEvent.CLOSE, page2, null); in webwindowhandler class: Object selectedEvent=null; public void webWindowClosed(WebWindowEvent wwe){ selectedEvent=wwe; } public Object getselectedEvent(){ return selectedEvent; Now in testcase if i put assert : STATEMENT 5: assertEquals(objwebwindowhandler.getselectedEvent(),expectedWindowEvent); -> This works perfectly fine as i expect . but now if i write a statement like : STATEMENT 3: HtmlPage page3 =(HtmlPage) ((HtmlAnchor) page2.getHtmlElementById("closeme")).click(); ->In place of STATEMENT 1 and perform the same bunch of steps as above said : then also it works fine i.e. STATEMENT 5 shows pass in the test. ->which is expected. but if i want to confirm: as STATEMENT 4: assertNull(page3) --> THIS TEST FAIL, I DIDN'T GET THIS POINT As the last argument of STATEMENT 2 is null so "newPage" is null instead of showing the same page. so in STATEMENT 3 "page3" object should return null and STATEMENT 4 should pass. I hope this would help you out to understand my problem.. Thanks for your help. Julien HENRY wrote: > Hi, > > Could you please write a minimal test case that reproduce the bug? Because > it's hard to debug without. > > ++ > > Julien > > ----- Message d'origine ---- > De : Monika Monika <[EMAIL PROTECTED]> > À : jwebunit-users@lists.sourceforge.net > Envoyé le : Mercredi, 17 Janvier 2007, 20h53mn 47s > Objet : [Jwebunit-users] problem with javascript:window.close() > > I am facing a problem from one of the popup window when i want to close > child window and get the focus on parent window. > What i am doing is : > somehwneer in html acnhor tag i am calling a javascript method > called newWindow() in opens up a popup window. UPTO this step it is > perfectly firn. > Now i do some modification which goes to database. Here again at one > anchor tag i have a link which closes that child window and gives a > focus to parent window. -( javascript:window.close() method) --> this > part is not working!!!!!!!!!!!!!!!! > at the last step when i click the link and want to view title of new > page object, it returns the same old title instead of returning the > values of parent html page. > > Any help is appreciated. > > Thanks & Regards.. > Monika > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Jwebunit-users mailing list > Jwebunit-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jwebunit-users > > > > > > > > > > ___________________________________________________________________________ > Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! > Profitez des connaissances, des opinions et des expériences des internautes > sur Yahoo! Questions/Réponses > http://fr.answers.yahoo.com > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Jwebunit-users mailing list > Jwebunit-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jwebunit-users > > > > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ JWebUnit-users mailing list JWebUnit-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jwebunit-users ___________________________________________________________________________ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses http://fr.answers.yahoo.com
jwebunit-test.piz
Description: Binary data
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ JWebUnit-users mailing list JWebUnit-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jwebunit-users