From: Marc G. <mgu...@ya...> - 2005-03-18 08:10:12
|
Hi Nikola, I couldn't reproduce your problem (which version of htmlunit do you use?). Please try to write a unit test illustrating the problem and open a bug issue with it, this is the best thing for developers to fix it. From your example I've written following unit test but it runs without problem. /** * @throws Exception if the test fails */ public void testOnChange() throws Exception { final String content = "<html><head>" + "<script>" + "function searchForm()" + "{" + " var oForm = document.frm;" + " window.location.href = 'foo&pfamilie=' + oForm.pfamilie.value;" + "}" + "</script></head>" + "<body><form name='frm' action=''>" + "<select name='pfamilie' onChange='searchForm()'>" + "<option value='11'>11</option>" + "<option value='12'>12</option>" + "<option value='13'>13</option>" + "<option value='14'>14</option>" + "</select>" + "</form>" + "</body></html>"; final HtmlPage page = loadPage(content); final HtmlForm form = page.getFormByName("frm"); final HtmlSelect select = form.getSelectByName("pfamilie"); final HtmlOption option = select.getOptionByValue("14"); select.setSelectedAttribute(option, true); } |