-
-
Notifications
You must be signed in to change notification settings - Fork 184
Closed
Description
I need to parse a html string.
Migrated from htmlunit 2.36.0 to 2.45.0 and now body is null:
String html = "<!DOCTYPE html><html><head></head><body></body></html>";
WebClient client = new WebClient();
client.getOptions().setCssEnabled( false );
client.getOptions().setJavaScriptEnabled( false );
StringWebResponse response = new StringWebResponse( html, new URL( "http://dummy.com" ) );
HtmlPage page = (HtmlPage) client.getPageCreator().createPage( response, client.getCurrentWindow() );
client.getPageCreator().getHtmlParser().parse( response, page, false );
assertNotNull( page.getBody() );
Htmlunit 2.36.0 code is similar but parsing differs:
HtmlPage page = HTMLParser.parseHtml( response, client.getCurrentWindow() );
A standard way of parsing html string, without relying on internal library code that may change, would be helpful.
Metadata
Metadata
Assignees
Labels
No labels