List Info

Thread: Selecting value from a List displayed through Autoextender




Selecting value from a List displayed through Autoextender
country flaguser name
United States
2007-04-10 05:34:44
I have a particular field in which  values are displayed
through Auto extender (.net) ie in the field if i start
entering alphabets like "A or a"  a drop down list
of names starting with "A or a" will be displayed.
Likewise if i enter "R or r" next to "A or
a" list of names starting with "AR or ar"
will be displayed.

My problem is that out of the displayed values in the list i
want to pick one value thru watir script. Here i can set or
enter the value i desired directly into the field, but it
won't solve my purpose. So i have to pick the value from the
displayed list only.

any help would be appreciatable.

thanks
_______________________________________________
Wtr-general mailing list
Wtr-generalrubyforge.org
htt
p://rubyforge.org/mailman/listinfo/wtr-general

Re: Selecting value from a List displayed through Autoextender
user name
2007-04-10 10:42:28
I'm not familiar with the auto extender, but I'm assuming it works on basically the same principle as this: http://demo.script.aculo.us/ajax/autocompleter . If you use IE developer toolbar on this page and enter text into the text field, you'll see that the dom is updated with a div, id of contact_name_auto_complete, class auto_complete which contains a list of names. The following script works and might give you some idea how to procede:

require 'watir'
include Watir

ie = IE.start('http://demo.script.aculo.us/ajax/autocompleter')
ie.text_field(:id, 'contact_name';).set(';al')
ie.text_field(:id, 'contact_name';).fire_event('onkeypress';)    # need to fire a key press event after setting the text since the js is handling keypress events

# the li/lis tags are available in watir 1.5.1
puts ie.div(:id, 'contact_name_auto_complete').lis.length
puts ie.div(:id, 'contact_name_auto_complete').li(:index, 5).text
ie.div(:id, 'contact_name_auto_complete').li(:text, 'Alan Jochen';).click

hth,

Charley

On 4/10/07, rkkanneganti < forum-watir-usersopenqa.org">forum-watir-usersopenqa.org> wrote:
I have a particular field in which ; values are displayed through Auto extender (.net) ie in the field if i start entering alphabets like "A or a"&nbsp; a drop down list of names starting with "A or a" will be displayed. Likewise if i enter "R or r" next to "A or a" list of names starting with "AR or ar" will be displayed.

My problem is that out of the displayed values in the list i want to pick one value thru watir script. Here i can set or enter the value i desired directly into the field, but it won't solve my purpose. So i have to pick the value from the displayed list only.

any help would be appreciatable.

thanks
_______________________________________________
Wtr-general mailing list
Wtr-generalrubyforge.org">Wtr-generalrubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )