have you tried scripting a firing of the onchange event against the element after you have done the select?
browser.frame("mainFrame").select_list(:name,"servname").fire_event("onchange") On Mar 2, 6:52 pm, WinDy <lyfi2...@sina.com> wrote: > I have a web page to test. > > The page like this: > > <select name="servname" onchange="javascript:changeServSelect();"> > ...</select> > > <select name="appname" onchange="javascript:ChangeAppSelect();">..</select> > > other... > > When I select something on the first select_tag, The second one' values > will be changed. > > But When I select it using watir( watir1.6.5 ,watir1.7.1 watir1.8.0) : > > browser.frame("mainFrame").select_list(:name,"servname").select("HTTP") > > I find the second one's values are cleanup. It appears that 'onchange' > event function executes wrong in watir ! > > some code may be useful: > > changeServSelect function 'code > > function ChangeServSelect() > { > document.all('appname').options.length=0; > var index = document.all('servname').selectedIndex; > if(index >= 0) > { > var servvalue = > document.all('hideservvalues').options[index].value; > var servArray = servvalue.split("?"); > var len = 0; > for(; len < servArray.length; len = len + 1) > { > var appArray = servArray[len].split("!"); > document.all('appname').add(new Option(appArray[0], > appArray[0])); > } > ChangeAppSelect(); > } > > } > > ChangeAppSelect: > > function ChangeAppSelect() > { > document.all('subdividetype').options.length=0; > var servindex = document.all('servname').selectedIndex; > var appindex = document.all('appname').selectedIndex; > if(servindex >= 0) > { > var servvalue = > document.all('hideservvalues').options[servindex].value; > var servArray = servvalue.split("?"); > var appArray = servArray[appindex].split("!"); > if(appArray.length<=1) > > document.getElementById('subdividetype').style.display="none"; > else > { > document.getElementById('subdividetype').style.display=""; > for(var len=1; len < appArray.length; len = len + 1) > document.all('subdividetype').add(new > Option(appArray[len], > appArray[len])); > } > } > > } > > i'm sorry that i can't upload my whole page. > > thanks for your help at all. > > -- > 使用 Opera 革命性的电子邮件客户程序:http://www.opera.com/mail/ -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com