Skip to content

Difference with HtmlUnit while mathjax script processing #32

@ars18wrw

Description

@ars18wrw

I try to process web pages with mathml using mathjax via nhtmlunit

In java (using htmlunit) everything is fine.
I use the next snippet:

WebClient webClient = new WebClient(BrowserVersion.CHROME);
HtmlPage page = webClient.getPage(new File(mathml).toURI().toURL());
webClient.waitForBackgroundJavaScript(300000 * 1000);
String pageAsXml = page.asXml();

and the next html - https://pastebin.com/hvJZmtnH
The result is quite good : https://pastebin.com/kHzrM3rJ

However it's not so good in C# (NHtmlUnit):

The code i use:

WebClient webClient = new WebClient(BrowserVersion.CHROME);
webClient.Options.JavaScriptEnabled = true;
webClient.Options.Timeout = 30000;
webClient.Options.RedirectEnabled = true;
HtmlPage page = webClient.GetHtmlPage(mathml);
webClient.WaitForBackgroundJavaScript(50000000);
string pageAsXml = page.AsXml();

The result: https://pastebin.com/E5uXfUZ1

As you can see the javascript wasn't processed.

Please confirm that it's impossible to process such scripts via NHtmlUnit or point me out how to fix the issue.

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