gaellalire · GitHub

Caused by: java.lang.NullPointerException: null
	at com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.getLeft(ComputedCSSStyleDeclaration.java:1580)
	at com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getOffsetLeft(HTMLElement.java:1393)

Issue is still there in 2.62.0.

I tested if parent is null to workaround the issue, worked for me but maybe not the best fix.

			final HTMLElement parent = (HTMLElement) getElement().getParentElement();
			if (parent != null) {
				final ComputedCSSStyleDeclaration style = parent.getWindow().getComputedStyle(parent, null);
				left = pixelValue(style.getLeftWithInheritance());
			} else {
				left = 0;
			}

Read the original on github.com ↗