From: David D. K. <ddk...@ki...> - 2005-07-15 15:00:27
|
If you want to call executeJavaScriptFunctionIfPossible() if possible yourself, I would recommend downloading the Htmlunit source code and studying it. However, I'm certain that calling executeJavaScriptFunctionIfPossible() is not supported. Instead I would recommend adding a button to the web page at run-time (see the AddFormField example on the wiki) with an "onclick" event set to call your JavaScript function. Then simply click the button to call the JavaScript function. http://htmlunit.sourceforge.net/phpwiki/index.php/AddFormField Dave On Jul 7, 2005, at 2:40 AM, Thomas Pich wrote: > Hi, > > could anybody give me an example, how can I invoke a Javascript- > Function > with Htmlunit? Perhaps like this: > > <script type="text/javascript"> > function FunctionXYZ () { > ... > } > </script> > > final WebClient webClient = new WebClient(); > final URL url = new URL( "http://y.x.z/test.html" ); > final HtmlPage page1 = ( HtmlPage ) webClient.getPage( url ); > > final ScriptResult result = > page1.executeJavaScriptFunctionIfPossible( ?FunctionXYZ?, ???, > this, null, null ); > > I don't know, which parameters are required. > > Thanks, > Thomas |