I am working on a polymer project and I am importing the standard polyfill webcomponents-lite.js https://github.com/WebComponents/webcomponentsjs
Importing the file in my HTML <script src="webcomponentsjs/webcomponents-lite.js"></script> gives the following error
EcmaError: lineNumber=[107] column=[0] lineSource=[<no source="">]</no> name=[TypeError] sourceName=[http://localhost:8080/webcomponentsjs/webcomponents-lite.js] message=[TypeError: Expected argument of type object, but instead had type object (http://localhost:8080/webcomponentsjs/webcomponents-lite.js#107)]
com.gargoylesoftware.htmlunit.ScriptException: TypeError: Expected argument of type object, but instead had type object (http://localhost:8080/webcomponentsjs/webcomponents-lite.js#107)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:894)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:637)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:518)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:774)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:750)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:102)
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:991)
at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:366)
at com.gargoylesoftware.htmlunit.html.HtmlScript$2.execute(HtmlScript.java:247)
at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:268)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:800)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:756)
at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1236)
at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1136)
at net.sourceforge.htmlunit.cyberneko.filters.DefaultFilter.endElement(DefaultFilter.java:226)
at net.sourceforge.htmlunit.cyberneko.filters.NamespaceBinder.endElement(NamespaceBinder.java:345)
at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3178)
at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2141)
at net.sourceforge.htmlunit.cyberneko.HTMLScanner.scanDocument(HTMLScanner.java:945)
at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:521)
at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:472)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:999)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:250)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:192)
The code being used is:
URL url = new URL(urlString);
StringWebResponse htmlUnitResponse = new StringWebResponse(rawHtml, url);
WebClient webClient = new WebClient(BrowserVersion.FIREFOX_52);
webClient.getOptions().setJavaScriptEnabled(true);
HtmlPage page = HTMLParser.parseHtml(htmlUnitResponse, webClient.getCurrentWindow());
...
I tried setting various browser versions in the WebClient constructor. The screen loads on FireFox and Chrome. Is this library not supported?
can you please provide a complete sample (simple page including all referenced resources)
Any hope for getting the sampe?
Immanuel,
if you like to get this solved please provide a simple sample. Like a small HtmlPage that includes the (non minified) version of webcomponents and some lines of HtmlUnit code that load the page and does anything additional needed to show the problem.
Please keep in mind you get this software for free (have a look here to get an idea https://www.openhub.net/p/HtmlUnit/estimated_cost). Without your help it will be impossible to work on this (because i maintain this in my spare time).
Sorry we decided not to use polymer (partially because of issues like this) and so this issue is no longer relevent to us. You may please close this issue
Thanks for the feedback.
See https://sourceforge.net/p/htmlunit/bugs/2005/