From: Rousseau, J. R. <JRR...@Ba...> - 2004-12-10 15:16:41
|
Hi, Here is more info about my problem. I'm really confused, because I have similar headers in other pages and they work ok !!. Any ideas ? code: URL url = new URL(state.getBaseUrl()+"/html/admin/home_en.html"); HtmlPage page = null; page = (HtmlPage)state.getWebClient().getPage(url); HtmlForm form = page.getFormByName("login"); form.getInputByName("userid").setValueAttribute(cells.more.text().toUpperCas e()); form.getInputByName("password").setValueAttribute(cells.more.more.text().toU pperCase()); Page p = form.submit(); System.out.println(p); System.out.println(p.getWebResponse().getContentAsString()); state.setCurrentPage((HtmlPage)form.submit()); This gives me a ClassCastException because the response page is an UnexcpectedPage. output: com.gargoylesoftware.htmlunit.UnexpectedPage@302e67 <html xmlns:translator="com.banctec.pca.pub.PublicLanguageTranslatorUtil" xmlns:java="java"> <head> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <link href="/pca/stylesheets/pcaadmin.css" type="text/css" rel="stylesheet"> <title>PCA Admin: Users List</title> </head> (...) > -----Original Message----- > From: Rousseau, Jean Rene > Sent: Thursday, December 09, 2004 4:46 PM > To: 'htm...@li...' > Subject: [Htmlunit-user] Re: Problems handling with the > Content-Type is > specified using ME TA tags? > > > Hi All, > > I found this old message in the archive concerning a > "UnexcpectedPage" > problem. I still have this problem and it happens only if a specify a > specific charset. > > Any news on this bug ? > > thanks, > > Jean-Rene Rousseau > > -------------------------------------------------------------- > -------------- > ---- > >Raj Wagle wrote: > > If a page is sent without the "Content-Type" response > header, but is > specified as > follows: > > <META http-equiv="Content-Type" content="text/html; > charset=ISO-8859-5"> > > > > seems either htmlunit or httpclient is unable to handle it > correctly. > > > > The page gets returned as "UnexpectedPage". > > Any thoughts? > > I thought that commons-httpclient would take care of this > automatically > - I remember discussions about this on their mailing list a > while ago. > To work around this, you could register a custom PageCreator > with the > WebClient. > > Please open a bug report for this. > > -- > Mike Bowler > Principal, Gargoyle Software Inc. > Voice: (416) 822-0973 | Email : mbowler@Ga... > Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from > real users. > Discover which products truly live up to the hype. Start reading now. > http://productguide.itmanagersjournal.com/ > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > |