Skip to content

NullPointerException with javaScriptEnabled=false #227

@dhcode

Description

@dhcode

Exception:
Caused by: java.lang.NullPointerException
at com.gargoylesoftware.htmlunit.html.HtmlInput.executeOnChangeHandlerIfAppropriate(HtmlInput.java:509)
at com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput.setChecked(HtmlCheckBoxInput.java:122)

Reproduce:

  • Create a WebClient with the constructor option javaScriptEngineEnabled=false.
  • Load a page with an Checkbox
  • Set the checkbox to checked

Location: https://github.com/HtmlUnit/htmlunit/blob/master/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java#L509

It seems like engine is null in this case:

        final AbstractJavaScriptEngine<?> engine = htmlElement.getPage().getWebClient().getJavaScriptEngine();
        if (engine.isScriptRunning()) {
            return page;
        }

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions