From: Mike B. <mb...@Ga...> - 2003-02-27 11:41:50
|
> I don't understand the approach on testing JS with HtmlUnit. Should it > work transparently or do I have to execute JS-code explicit? Yes, it should work transparently. If you click on an HtmlButton for example, it will fire the onclick handler if available. > How is HtmlUnit with JS enabled supposed to behave? Should I simply get > a new page when changing the option in the select-element? (Ok, that > already didn't work ;) Or do I have to call the JS-functions by myself > using HtmlPage.executeJavaScriptIfPossible()? For normal use, you shouldn't need to call executeJavaScriptIfPossible at all. It's there if you really need it but the handlers are supposed to be called automatically. The HtmlSelect will execute the onchange handler on changes. What is the problem you're seeing. > BTW: The documentation of that method confused me a little bit. It says > in its signature, that it will return a ScriptResult, but it says in the > description below, that it will return a Page. I couldn't try it out > yet, but I'm curious what would gonna happen ;) It returns a ScriptObject which in turn contains the new page (if one was loaded) and the actual result returned by the rhino script engine. The documentation has been fixed to reflect this. FWIW, the javascript support will only work if javascript is enabled. If javascript isn't working at all then make sure that js.jar is in your classpath and that you haven't disabled javascript support in the WebClient. -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |