From: Andrey S. <asu...@oi...> - 2004-09-03 08:45:48
|
Er, after taking a second and a third look at your code, I understood that my previous letter missed the point. While onSubmit is still wrong, your problem happens somewhere else. The misnamed onsubmit is simply ignored, and the code should proceed directly to action. What do you mean by "not called"? Does absolutely nothing? Fails with exception? prints something to log? From the first look, the quoted pieces should generally work. In particular, image buttons are supported and, when clicked, should submit the form; form action can be a javascript:foo() url; and assigning new url to document.location.href is supported. I expect that doSearch() itself is called, but an error happens somewhere along the way. I would recommend registering an AlertHandler by calling aWebClient.setAlertHandler(h) that prints alert text to System.out. Then systematically insertng alert() in javascript to pinpoint the error. This is what I do when something strange happens in tested pages (i.e. all the time :). Also make sure that your HtmlUnit logging is enabled. Maybe add assertTrue(aWebClient.getLog().isErrorEnabled()) to your test. Andrey |