From: Mike B. <mb...@Ga...> - 2003-08-23 11:51:12
|
Johannes Trost wrote: > I suspect that HTMLUnit does not recognize a > page with content type "text/html" (which would > result in a HtmlPage object). Instead > I get a "text/plain", resulting in a TextPage object. > Has anybody observed a similar behaviour ? If the server is sending back a content type header of "text/html" then you will get an HtmlPage. If there is no content header then you might get the behaviour you are seeing. > Is there any "trick" to "cast" a TextPage to > a HtmlPage ? Once the page has been created you cannot change it from one kind to another. You can however provide your own PageCreator to customize the kind of page that is created for each content type. http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/WebClient.html#setPageCreator(com.gargoylesoftware.htmlunit.PageCreator) -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |