question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception invoking getOffsetHeight - 2.37.0

See original GitHub issue

Hey Ron,

I recently upgraded to 2.37.0 and now I encounter these:

ERROR  [11:14:21.750]  Error during JavaScript execution
com.gargoylesoftware.htmlunit.ScriptException: Exception invoking getOffsetHeight
        at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:882)
        at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:624)
        at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:537)
        at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:354)
        at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:811)
        at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:783)
        at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunction(HtmlPage.java:2567)
        at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunction(HtmlPage.java:2560)
        at com.gargoylesoftware.htmlunit.javascript.host.event.EventListenersContainer.executeEventListeners(EventListenersContainer.java:342)
        at com.gargoylesoftware.htmlunit.javascript.host.event.EventListenersContainer.executeAtTargetListeners(EventListenersContainer.java:379)
        at com.gargoylesoftware.htmlunit.javascript.host.event.EventTarget.fireEvent(EventTarget.java:171)
        at com.gargoylesoftware.htmlunit.html.DomElement.lambda$fireEvent$0(DomElement.java:1451)
        at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:624)

Seems to happen in a place where I input some text into a text input field searchField.setText("2148486168"); or right after that when submitting searchField.type('\n');.

Runs fine w/ 2.36.0.

I’m afraid that’s all the intel I can give you on this. Here’s the trace:

com.gargoylesoftware.htmlunit.ScriptException: Exception invoking getOffsetHeight
        at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:882)
        at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:624)
        at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:537)
        at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:354)
        at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:811)
        at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:783)
        at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunction(HtmlPage.java:2567)
        at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunction(HtmlPage.java:2560)
        at com.gargoylesoftware.htmlunit.javascript.host.event.EventListenersContainer.executeEventListeners(EventListenersContainer.java:342)
        at com.gargoylesoftware.htmlunit.javascript.host.event.EventListenersContainer.executeAtTargetListeners(EventListenersContainer.java:379)
        at com.gargoylesoftware.htmlunit.javascript.host.event.EventTarget.fireEvent(EventTarget.java:171)
        at com.gargoylesoftware.htmlunit.html.DomElement.lambda$fireEvent$0(DomElement.java:1451)
        at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:624)
        at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:537)
        at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:354)
        at com.gargoylesoftware.htmlunit.html.DomElement.fireEvent(DomElement.java:1451)
        at com.gargoylesoftware.htmlunit.html.DomElement.fireEvent(DomElement.java:1423)
        at com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:126)
        at com.gargoylesoftware.htmlunit.html.HtmlElement.type(HtmlElement.java:596)
        at com.gargoylesoftware.htmlunit.html.HtmlElement.type(HtmlElement.java:498)
        at a.b.c.d.e.f(f.java:95)
        at a.b.c.d.e.f(f.java:61)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at org.junit.runners.Suite.runChild(Suite.java:128)
        at org.junit.runners.Suite.runChild(Suite.java:27)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:105)
        at a.b.c.d.e(f.java:203)
        at a.b.c.d.run(d.java:142)
        at a.b.c.d.run(d.java:21)
        at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87)
        at io.dropwizard.cli.Cli.run(Cli.java:78)
        at io.dropwizard.Application.run(Application.java:93)
        at a.b.c.d.main(d.java:70)
Caused by: java.lang.RuntimeException: Exception invoking getOffsetHeight
        at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:214)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject$GetterSlot.getValue(ScriptableObject.java:348)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.get(ScriptableObject.java:475)
        at com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.get(SimpleScriptable.java:79)
        at com.gargoylesoftware.htmlunit.javascript.host.Element.get(Element.java:517)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getProperty(ScriptableObject.java:2340)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1586)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1579)
        at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1437)
        at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:1009)
        at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:111)
        at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:427)
        at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:340)
        at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3607)
        at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$3.doRun(JavaScriptEngine.java:804)
        at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:867)
        ... 63 common frames omitted
Caused by: java.lang.StringIndexOutOfBoundsException: start 0, end 1, length 0
        at java.base/java.lang.AbstractStringBuilder.checkRangeSIOOBE(AbstractStringBuilder.java:1813)
        at java.base/java.lang.AbstractStringBuilder.substring(AbstractStringBuilder.java:1077)
        at java.base/java.lang.StringBuilder.substring(StringBuilder.java:85)
        at com.gargoylesoftware.htmlunit.html.HtmlSerializer$HtmlSerializerTextBuilder.getText(HtmlSerializer.java:742)
        at com.gargoylesoftware.htmlunit.html.HtmlSerializer.asText(HtmlSerializer.java:47)
        at com.gargoylesoftware.htmlunit.html.DomNode.asText(DomNode.java:808)
        at com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.getEmptyHeight(ComputedCSSStyleDeclaration.java:1263)
        at com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.getCalculatedHeight(ComputedCSSStyleDeclaration.java:1187)
        at com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.getCalculatedHeight(ComputedCSSStyleDeclaration.java:1153)
        at com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getOffsetHeight(HTMLElement.java:1202)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:188)
        ... 78 common frames omitted

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
rbricommented, Mar 3, 2020

Ok, found at least one code path that reproduces your problem. Will make a new snapshot available soon.

1reaction
rbricommented, Feb 17, 2020

Sorry for that, will try to reproduce and fix this - but there is no time this week. Hope this is ok for you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Element offsetHeight always "0" - javascript - Stack Overflow
You are trying to get offsetHeight of a hidden element. the css .navbar ul li ul has display:none that would make all of...
Read more >
Changes - HtmlUnit - SourceForge
1. rbri. Fix, Text content based width calculations in ComputedCSSStyleDeclaration now using the getVisibleText() method to come closer to real browsers (e.g. ...
Read more >
HTMLElement.offsetHeight - Web APIs | MDN
The HTMLElement.offsetHeight read-only property returns the height of an element, including vertical padding and borders, as an integer.
Read more >
Chromium and Selenium in AWS Lambda - Vittorio Nardone -
A simple example of how to use Selenium in Python: the get method allows to direct the browser to the indicated URL, while...
Read more >
HTML DOM Element offsetHeight Property - W3Schools
The offsetHeight property returns the viewable height of an element (in pixels), including padding, border and scrollbar, but not the margin.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found