Cannot call method "getElementsByClassName" of undefined
See original GitHub issueEcmaError: lineNumber=[5] column=[0] lineSource=[ const prevButton = carousel.parentElement.getElementsByClassName("carousel-previous-button")[0];] name=[TypeError] sourceName=[https://www.fdic.gov/assets/javascript/carousels.js] message=[TypeError: Cannot call method "getElementsByClassName" of undefined (https://www.fdic.gov/assets/javascript/carousels.js#5)] com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot call method "getElementsByClassName" of undefined (https://www.fdic.gov/assets/javascript/carousels.js#5) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:891) at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:619) at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:537) at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:354)
Getting the above JavaScript exception when trying to scrape https://www.fdic.gov/news/press-releases/2020/
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (7 by maintainers)
Top GitHub Comments
You think i need a whole week only to suppress the exception?
The page includes several js parts - usually huge js scripts. It will not be that easy to figure out why some js parts are working different from real browsers. If you like to get this fixed you can help to nail down the problem to the problematic function. You can have a look at https://htmlunit.sourceforge.io/submittingJSBugs.html for some hints how to do it.
Will try to get this done during this week.