From: Arya F. <ary...@gm...> - 2014-01-19 20:16:12
|
This problem could also be because of a server error On Sun, Jan 19, 2014 at 11:02 AM, Arya Farzan <ary...@gm...> wrote: > I tried it with > > webClient.setAjaxController(new NicelyResynchronizingAjaxController()); > > but I am still facing the same issue. I have also put Thread.sleep(5000) > after > > HtmlPage page2 = form.getInputByValue("Submit").click(); > > but it's not making any difference. Also I don't know if this is relevant > but this is a custom constructed html page which I'm generating by this code > > URL url = new URL("ThePAGEURL"); > > StringWebResponse response = new > StringWebResponse("<html><head><title>attach</title></head><body><form > method='post' action='POSTURL'><input type='file' name='file0'><input > type='text' name='requests' value='" + request + "'><input type='text' > name='automatic' value='false'><input type='submit' > value='Submit'></form></body></html>", url); > HtmlPage page = HTMLParser.parseHtml(response, > webClient.getCurrentWindow()); > > > When the server's response is not returned but the html form is returned, > there is one head tag printed and it looks like this: <head/> > > On Sun, Jan 19, 2014 at 2:58 AM, Ahmed Ashour <asa...@ya...> wrote: > >> Hi Arya, >> >> Please read http://htmlunit.sourceforge.net/faq.html#AJAXDoesNotWork >> >> Ahmed >> ------------------------------ >> *From:* Arya Farzan <ary...@gm...> >> *To:* htm...@li... >> *Sent:* Sunday, January 19, 2014 6:22 AM >> *Subject:* [Htmlunit-user] HtmlPage returning form instead of content >> >> I'm using the following code to submit a form >> >> HtmlForm form = page.getForms().get(0); >> form.getInputByName("file0").setValueAttribute("1.jpg"); >> HtmlPage page2 = form.getInputByValue("Submit").click(); >> >> This "sometimes" returns the server's response, but sometimes returns the >> form itself when I print page2's text or xml. >> >> Am I doing something wrong here? >> >> >> >> ------------------------------------------------------------------------------ >> CenturyLink Cloud: The Leader in Enterprise Cloud Services. >> Learn Why More Businesses Are Choosing CenturyLink Cloud For >> Critical Workloads, Development Environments & Everything In Between. >> Get a Quote or Start a Free Trial Today. >> >> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk >> _______________________________________________ >> Htmlunit-user mailing list >> Htm...@li... >> https://lists.sourceforge.net/lists/listinfo/htmlunit-user >> >> > |