question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ScriptException when trying to execute a function

See original GitHub issue

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)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rbricommented, Dec 31, 2019

Thanks, was able to reproduce this.

The problem is (at least) this line in the js code

    $.prototype.fa = function(style = "fas", ...classes) {

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.

0reactions
vmuthusamycommented, Dec 14, 2020

@rbri @thienbao860 Any progress on this issue?

Curious to understand what would be the Level of effort on this undertaking.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting an error while trying to access javascript from a java ...
If I remove the () I get another exception javax.script.ScriptException: ReferenceError: "document" is not defined in <eval> . That makes sense ...
Read more >
OATS- Unable to call function in other class from script.java
I am trying to call that function from script.java class in initialize ... ScriptException: An unexpected exception occurred in the script.
Read more >
Why do I receive the error "Attempt to execute SCRIPT ...
to determine which instance of [filename] that MATLAB is attempting to call. If you want to see all instances of a function on...
Read more >
about Try Catch Finally - PowerShell | Microsoft Learn
If PowerShell does not handle a terminating error in some way, PowerShell also stops running the function or script using the current ...
Read more >
Executing JavaScript on the JVM with Nashorn | anorak:girl
1, function testThing(thing) { ; 2, return thing === 'tiger' ; ; 3, } ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found