[wtr-general] Re: Select from auto-complete

2009-05-18 Thread Hemalatha Sivasubramaniam
Hi all,

we have found out a solution for the query i posted and it is working fine.

The solution is

browser2.text_field(:class,dojoComboBox).focus()
browser2.text_field(:class,dojoComboBox).set T
browser2.text_field(:class,dojoComboBox).fire_event('onkeyup')
browser2.image(:class,dojoComboBox).fire_event('onmouseup')
browser2.div(:text,/T MATHI/).click
browser2.text_field(:class,dojoComboBox).fire_event('onfocus')

This works Fine.

Now i have another one field of same type in the same page. i.e, the page
has two auto-complete fields.
Since i cannot differentiate them with names, i don't know how to write
watir scripts. It has the same class name.

HTML is
 input type=text dojoattachpoint=textInputNode
dojoattachevent=key:_handleKeyEvents; keyUp: onKeyUp; compositionEnd;
onResize; class=dojoComboBox autocomplete=off style=/
img hspace=0 vspace=0
src=/eglcms/struts/dojo/src/widget/templates/images/combo_box_arrow.png
dojoattachevent=onMouseUp: handleArrowClick; onResize;
dojoattachpoint=downArrowNode class=dojoComboBox style=width: 14px;
height: 14px;/

and when i type in something (say letter S), i should be able to select
from the list that appears like this
span style=position: absolute; width: 140px; height: 17px; z-index: 1001;
left: 249px; top: 918px; opacity: 0; display: none;
class=dojoComboBoxOptionsdiv resultname=SIVA S resultvalue=23
class=dojoComboBoxItem dojoComboBoxItemEvenbSIVA S/b/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:
 My Code is

browser2.table(:index,1)[21][3].text_field(:class,dojoComboBox).focus()
browser2.table(:index,1)[21][3].text_field(:class,dojoComboBox).set S
browser2.table(:index,1)[21][3].text_field(:class,dojoComboBox).fire_event('onkeyup')
browser2.table(:index,1)[21][3].text_field(:class,dojoComboBox).fire_event('onmouseup')
browser2.table(:index,1)[21][3].text_field(:class,dojoComboBox).div(:text,/SIVA
S/).click
browser2.table(:index,1)[21][3].text_field(:class,dojoComboBox).fire_event('onfocus')
I get an error saying

Unable to locate element, using :text, /SIVA S/

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


Thanks and Regards,
Hema

On Mon, Apr 27, 2009 at 8:41 PM, Paul Rogers paul.rog...@shaw.ca wrote:

 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=22T 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 

[wtr-general] Re: Select from auto-complete

2009-04-27 Thread Paul Rogers
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=22T 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
-~--~~~~--~~--~--~---