When clicking on HtmlAnchor, a pop-up window should appear. However, the program crashes with the error message: com.gargoylesoftware.htmlunit.ScriptException: Exception invoking open. Below is the code and console printouts for reference. The href attribute is as follows:
Javascript:window.open('https://www.apps.amway.hu/shop/los/los.aspx?lng=hu', 'points_window', 'width=830,height=580,location=0,menubar=0,resizable=1,scrollbars=1,status=1,titlebar=0,toolbar=0');void(0);
Your assistance in resolving this issue is greatly appreciated.
link = (HtmlAnchor) page.getFirstByXPath("//*[@id=\"content\"]/div[2]/div[2]/div[3]/a");
System.out.println("link text= ,"+link.asText()+" hreg= "+link.getHrefAttribute());
page= (HtmlPage) link.click();
The error report generated is as follows:
com.gargoylesoftware.htmlunit.ScriptException: Exception invoking open
======= EXCEPTION START ========
Exception class=[java.lang.RuntimeException]
com.gargoylesoftware.htmlunit.ScriptException: Exception invoking open
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:894)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:628)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:515)
...
... more detailed exception information can be found in the original content above...
...
======= EXCEPTION END ========