-
-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ScriptException when trying to execute a function #111
Comments
Looks like a syntax error in the source file. Can you please check if you get this with real browsers also. |
I checked it, it seems like the Login button in the real browser's working well, with only 2 warnings (those are not mentioning about syntax) Edit: I just tested the same code, but with bare Selenium, and it's working well. Seems HtmlUnitDriver is my only "head-less" browser choice without any browser installation though, but it keeps doing the same EvaluatorException Edit 2: I've put |
setThrowExceptionOnScriptError(false) still logs the error but does not stop the js execution at the place the error occures. And please use the latest version (or even better the latest SNAPSHOT build) |
https://aternos.org:443/panel/js/aternos.js?v=30042019#1 And yes, I am using ver 2.36.0 for the driver |
Sorry but simply pointing to the js is not a complete sample. |
Sorry for the long response:
There you go |
Thanks, was able to reproduce this. The problem is (at least) this line in the js code
At the moment Rhino (the base of the js implementation in HtmlUnit) does not support the spread operator (https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Operators/Spread_operator). And adding the support is not that simple. |
So what now? |
What about working together on this to add the support in Rhino? |
@rbri @thienbao860 Any progress on this issue? Curious to understand what would be the Level of effort on this undertaking. |
see #755 |
So as the title said, however in this case the script in the website cannot be modified (the script is in the error). When I try to execute login() from the click, it tells me a ScriptError exception (this is from the Selenium which uses HtmlUnitDriver):
WebElement submit = driver.findElement(By.id("login")); submit.click();
Error:
======= EXCEPTION START ======== Exception class=[net.sourceforge.htmlunit.corejs.javascript.EvaluatorException] com.gargoylesoftware.htmlunit.ScriptException: missing ) after formal parameters: (https://aternos.org:443/panel/js/aternos.js?v=30042019#1) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:883) at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:617) at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:534) at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:336) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:714) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:680) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:103) at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1102) at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:982) at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:362) at com.gargoylesoftware.htmlunit.html.HtmlScript$2.execute(HtmlScript.java:236) at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:257) at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:792) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:748) at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1175) at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1115) at net.sourceforge.htmlunit.cyberneko.filters.DefaultFilter.endElement(DefaultFilter.java:219) at net.sourceforge.htmlunit.cyberneko.filters.NamespaceBinder.endElement(NamespaceBinder.java:303) at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3146) at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2074) at net.sourceforge.htmlunit.cyberneko.HTMLScanner.scanDocument(HTMLScanner.java:922) at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:438) at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:389) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:991) at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:246) at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:190) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:269) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:160) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:534) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:400) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:317) at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:715) at org.openqa.selenium.htmlunit.HtmlUnitDriver.lambda$get$8(HtmlUnitDriver.java:697) at org.openqa.selenium.htmlunit.HtmlUnitDriver.lambda$runAsync$0(HtmlUnitDriver.java:438) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
The text was updated successfully, but these errors were encountered: