From: SourceForge.net <no...@so...> - 2003-06-03 04:25:13
|
Support Requests item #747350, was opened at 2003-06-02 14:56 Message generated for change (Comment added) made by ncjt You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448267&aid=747350&group_id=47038 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Mike Bowler (mbowler) Summary: Using HtmlImageInput Initial Comment: Hello, Can any one tell me how to use the HtmlImageInput to submit the form? I can read the form from the web. e.g final HtmlForm form = page1.getFormByName ("loginform"); final HtmlTextInput userName = (HtmlTextInput) form.getInputByName("txtLoginName"); userName.setValueAttribute("my name"); but the following i'm not sure is it the right way to get the object instance? assumption the image name called "Login" form method = post, action='login.asp" the image tag like <input type="image" name="Login" src="../images/content/login_button.gif" value="Login" border="0" WIDTH="56" HEIGHT="16"> when click it will submit the form. In general the web page is host on 3rd party location and they will not give any support for this instance. final HtmlImageInput login = (HtmlImageInput) form.getInputByName("Login"); Since the login is a image. and i try to get the response from the page. final HtmlPage page2 = (HtmlPage)login.click(); WebResponse resp1 = page2.getWebResponse(); it will throw the exception but the error message is null. Can anyone help me? Many thanks..... Jeff ---------------------------------------------------------------------- Comment By: Jeff TSUI (ncjt) Date: 2003-06-03 12:25 Message: Logged In: YES user_id=790739 It's ok after using the commons-httpclient-2.0-beta1.jar. Many Thanks ---------------------------------------------------------------------- Comment By: Mike Bowler (mbowler) Date: 2003-06-02 22:54 Message: Logged In: YES user_id=46756 The exception is occuring inside commons-httpclient. The version of httpclient that shipped with HtmlUnit 1.2.2 was 2.0alpha3. They have just released 2.0beta1 which fixes a large number of bugs. Please try beta1 to see if this fixes your problem. http://www.ibiblio.org/maven/commons-httpclient/jars/commons-httpclient-2.0-beta1.jar ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2003-06-02 22:40 Message: Logged In: NO The stack trace are java.lang.NullPointerException at org.apache.commons.httpclient.HttpMethodBase.getRespons eBody(HttpMethodBase.java:670) at org.apache.commons.httpclient.methods.GetMethod.getResp onseBody(GetMethod.java:293) at com.gargoylesoftware.htmlunit.HttpWebConnection.makeWeb Response(HttpWebConnection.java:302) at com.gargoylesoftware.htmlunit.HttpWebConnection.getRespo nse(HttpWebConnection.java:106) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse (WebClient.java:928) at com.gargoylesoftware.htmlunit.WebClient.getPage (WebClient.java:305) at com.gargoylesoftware.htmlunit.WebClient.getPage (WebClient.java:242) at com.gargoylesoftware.htmlunit.html.HtmlForm.submit (HtmlForm.java:137) at com.gargoylesoftware.htmlunit.html.HtmlImageInput.doClickA ction(HtmlImageInput.java:60) at com.gargoylesoftware.htmlunit.html.HtmlInput.click (HtmlInput.java:87) at com.gargoylesoftware.htmlunit.html.HtmlImageInput.click (HtmlImageInput.java:47) at testHtmlUnit.main(testHtmlUnit.java:64) Many thanks ---------------------------------------------------------------------- Comment By: Mike Bowler (mbowler) Date: 2003-06-02 18:02 Message: Logged In: YES user_id=46756 Please include the stack trace ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448267&aid=747350&group_id=47038 |