From: <Mik...@su...> - 2002-12-16 22:18:54
|
In HtmlUnit 1.1 the default behavior of HtmlInput.click() is to submit the enclosing form when there is no onclick event handler. That is incorrect behavior for all types of input elements except type="submit". Since HtmlCheckBox.click() simply calls the same function in the superclass, it behaves incorrectly. Mike -- begin snipet from HtmlInput.java -- /** * Submit the form that contains this input. Only a couple of the inputs * support this method so it is made protected here. Those subclasses * that wish to expose it will override and make it public. * * @return The Page that is the result of submitting this page to the * server * @exception IOException If an io error occurs * @exception ElementNotFoundException If a particular xml element could * not be found in the dom model */ protected Page click() throws IOException, ElementNotFoundException { final String onClick = getOnClickAttribute(); final HtmlPage page = getPage(); if( onClick.length() == 0 || page.getWebClient().isJavaScriptEnabled() == false ) { return getEnclosingFormOrDie().submit(this); } else { return page.executeJavaScriptIfPossible( onClick, "onClick handler for "+getClass().getName(), true).getNewPage(); } } -- end snipet from HtmlInput.java -- |