you wont be ble to do this with watir at the moment. THe reason is that right now watir doesnt support all the event info on a key press ( most of the time watir works fine)
There is some stuff on the wiki that begins to address this - http://wiki.openqa.org/display/WTR/Possibilities+For+New+Events+in+Watir I have some more code that may help, but I dont know what state its in. Email me directly if you want it Paul On Mon, Apr 27, 2009 at 12:17 AM, Hemalatha Sivasubramaniam < hema.wa...@gmail.com> wrote: > I have a select field, that acts both as auto-complete and select box, i'm > not able to set value in that field using watir script. The HTML code for > that select field is below, > > <input class="dojoComboBox" type="text" dojoattachpoint="textInputNode" > dojoattachevent="key:_handleKeyEvents; > keyUp: onKeyUp; compositionEnd; onResize;" autocomplete="off" style=""/> > <img class="dojoComboBox" hspace="0" vspace="0" > src="/eglcms/struts/dojo/src/widget/templates/images/combo_box_arrow.png" > dojoattachevent="onMouseUp: > handleArrowClick; onResize;" dojoattachpoint="downArrowNode" style="width: > 14px; height: 14px;"/> > and when i type in something (say letter "T"), i should be able to select > from the list that appears like this > > <span class="dojoComboBoxOptions" style="position: absolute; width: 140px; > height: 32px; z-index: 1001; left: 325px; top: 702px; opacity: 0; display: > none;"> <div class="dojoComboBoxItem dojoComboBoxItemEven" resultname="T > MATHI" resultvalue="3"> > <b class="">T MATHI</b> > </div> > <div class="dojoComboBoxItem dojoComboBoxItemOdd" resultname="T BABU" > resultvalue="22">T BABU</div> > </span> > > If i have to select the first or the second option, How should i be doing > it in watir? > > I have tried firing the events, but the list doesn't appear. I have the > watir script code below: > > browser2.text_field(:class,"dojoComboBox").focus() > browser2.text_field(:class,"dojoComboBox").set "T" > browser2.text_field(:class,"dojoComboBox").fire_event('onblur') > Watir::Waiter.wait_until > {browser2.span(:class,"dojoComboBoxOptions").div(:text,/t mathi/).exists?} > browser2.div(:class,"formmainbox").span(:class,"dojoComboBoxOptions").div(:text,/t > mathi/).click > > I get an error at the wait until where the operation times out. > I have tried the script using Watir 1.6.2, Ruby 1.8.26 using both Firefox > 3.0 and IE 7.0 > > Any solution would be helpful. > > Regards, > Hema > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~----------~----~----~----~------~----~------~--~---