Subj : Possible bug with javascript(document.images) using Rhino js.jar To : netscape.public.mozilla.jseng From : neelima Date : Mon Jan 17 2005 09:13 pm Hi I have the following javascript function that alerts the image name in the jsp. It works fine when invoked from the browser. But when I invoke from the HttpUnit program I get undefined value. Test Programs: function validate() { alert(document.images[0].name); }
Steps 1) From the browser when the image is clicked the alert contains the name of the image. 2) From the Httpunit program, when the image is clicked the alert contains undefined. WebConversation wc = new WebConversation(); WebRequest request = new GetMethodWebRequest( "http://XXXXXXXX/httpunit.jsp" ); WebResponse resp = wc.getResponse( request ); WebImage image = resp.getImageWithName("image1"); (image.getScriptableDelegate()).doEvent("javascript:validate();"); System.out.println("Alert is : " + wc.getNextAlert()); However I get the alert value if the document.images[0].name is changed to document.images[0], but i required the document.images[0].name. Could you please suggest a possible solution. Thanks Neelima .