Skip to content

Null body #271

@cdalexndr

Description

@cdalexndr

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions