I'm trying to crawl a website using htmlunit. Whenever I run it though it only outputs the following error:
Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: TypeError: Cannot read property "push" from undefined (https://www.kinoheld.de/dist/prod/0.4.7/widget.js#1)
Now I don't know much about JS, but I read that push
is some kind of array operation. This seems standard to me and I don't know why it would not be supported by htmlunit.
Here is the code I'm using so far:
public static void main(String[] args) throws IOException {
WebClient web = new WebClient(BrowserVersion.FIREFOX_45);
web.getOptions().setUseInsecureSSL(true);
String url = "https://www.kinoheld.de/kino-muenchen/royal-filmpalast/vorstellung/280823/?mode=widget&showID=280828#panel-seats";
web.getOptions().setThrowExceptionOnFailingStatusCode(false);
web.waitForBackgroundJavaScript(9000);
HtmlPage response = web.getPage(url);
System.out.println(response.getTitleText());
}
What am I missing? Is there a way around this or a way to fix this? Thanks in advance!
web.getPage(url)
or theresponse.getTitleText()
call? – Crossindexweb.getPage(url)
, as I can comment out theresponse.getTitleText()
and it will still be thrown, even when theweb.getOptions().setThrowExceptionOnScriptError(false);
(see answer below) is inserted. – Muskogean