From: David D.K. <ddk...@ki...> - 2004-12-10 16:40:10
|
What "Content-Type:" header is your web server sending back for this page? (If you're using Mozilla or Firefox, you can do a "Get Info" once the page is loaded to find out, or use a packet sniffer like Ethereal to capture the headers "on the wire".) In htmlunit-1.3, the DefaultPageCreator.createPage() method is where the decision is made on what type of page to create. Apparently, this page is causing all of the if/else logic to fall through to create an UnexpectedPage object. Dave On Dec 10, 2004, at 9:16 AM, Rousseau, Jean Rene wrote: > 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().toUpp > erCase()); > > form.getInputByName("password").setValueAttribute(cells.more.more.text( > ).toUpperCase()); > > 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> > (...) |