Skip to content

com.gargoylesoftware.htmlunit.ScriptException: missing formal parameter (https://www.mohavecounty.us/Scripts/app/password_reset/index.js?v=2#100) #129

Description

@AbdenourAchab

With Firefox on Ubuntu 20.04 (latest daily build), I am able to read the contents of https://www.mohavecounty.us/ContentPage.aspx?id=111&cid=869&parcel=31344502 without any problem, regardless of the existence of script errors. However, when I try to do the same with HTMLUnit, using the following Java code and the latest release of HTMLUnit (version 2.37.0, which I downloaded from https://jar-download.com/artifact-search/htmlunit along with all its dependencies).

final WebClient webClient = new WebClient();
webClient.getOptions().setCssEnabled(false);
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.setRefreshHandler(new RefreshHandler() {
	public void handleRefresh(Page page, URL url, int arg) throws IOException {
	    System.out.println("handleRefresh");
	}
});
HtmlPage page = (HtmlPage) webClient.getPage("https://www.mohavecounty.us/ContentPage.aspx?id=111&cid=869&parcel=31344502");

I get the following exception:
com.gargoylesoftware.htmlunit.ScriptException: missing formal parameter (https://www.mohavecounty.us/Scripts/app/password_reset/index.js?v=2#100)

I understand that whoever has developed the website has messed up. But Firefox is able to handle that problem gracefully. I would like the next release of HTMLUnit to handle the same problem just as gracefully as Firefox. In the meantime, I would appreciate any workarounds and tips on how I can change my code to get it to open the web page without throwing the above referenced exception.

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