[wtr-general] Re: type-ahead select lists

2011-05-27 Thread Lisa Crispin
(re-sending, I don't think it got sent for some reason)

Now I am able to type text into the hidden field, but after looking at the
links Chuck recommended, the code from Paul, and lots of other Googling
around, I'm still flummoxed on trying to get the event to fire.

Here is the html:
 select dojoType=dijit.form.FilteringSelect id='advisorId'
name='advisorId' onchange=javascript:selectPlanAdvisor();
option value=0  selected 
No Advisor
/option
option value=3785 
FERNANDEZ, KEVIN S
/option
/select

Here is what I've tried to try to fire the event:
 ie.hidden(:id, 'advisorId').fire_event(onchange)

This returns a value of yellow in irb (WTF?) but does not fire the JS.

One of the Java developers here tried to help, but he's as baffled as I am.
Any other suggestions? I will have many scripts broken because of this, and
I depend on those scripts to help with our exploratory testing as well as
testing releases to the staging environment. I don't want to lose them!

thanks,
Lisa


On Thu, May 26, 2011 at 1:44 AM, Chuck van der Linden sqa...@gmail.comwrote:

 I'd wager it's working off keypress events.  Problem is we can't
 easily fire those in watir because the .fire_event method only takes a
 single parameter (the event) and I believe to work properly keypress
 needs a parameter for the value of the key that was depressed.

 You might need to write your own function that executes the javascript
 fireevent function instead, similar to this item from Stackoverflow a
 year or two ago
 http://stackoverflow.com/questions/602069/autocomplete-dropdown-test-with-ruby-watir

 Another alternative is described here
 http://zbarzone.blogspot.com/2008/08/watir-sendkeys-and-javascript.html
 and that approach might actually be better for you.

 To fix this 'for real' it seems we'd need to first modify .fire_event
 to allow for a second parameter, or create a new method such
 as .fire_key_event  that would take two parameters.  Then any other
 methods that have keypress events in them such as .set would need to
 be altered to fire the down/press/up events character by character and
 fire those events with the proper 'key' values for each character.

 On May 24, 11:24 am, Lisa Crispin lisa.cris...@gmail.com wrote:
  I tried the log events thing, it's nice to know about that, but I don't
 see
  anything that really looks like the JS firing. I see a lot of 'select',
  'click' 'keydown', 'input', 'keypress', 'keyup', none of that looks like
  what the JS is doing with the type ahead.
  -- LIsa
 
  On Mon, May 23, 2011 at 2:36 PM, Željko Filipin 
 
 
 
 
 
 
 
 
 
  zeljko.fili...@wa-research.ch wrote:
   On Mon, May 23, 2011 at 9:44 PM, Lisa Crispin lisa.cris...@gmail.com
   wrote:
We are changing what used to be regular drop-down select list boxes
 to a
   dojo widget thingie that allows type ahead to select the item.
 
   Is the page public? Or a similar page? Frameworks usually have examples
   somewhere online.
 
   If you think the only problem is that a JavaScript event is not fired
 (by
   Watir), take a look at this:
 
  http://stackoverflow.com/questions/3787555/how-to-find-out-which-java.
 ..
 
   If the site is not public, but you could show it to me, contact me off
   list.
 
   Željko
   --
   watir.com - community manager
   watir.com/book - author
   watirpodcast.com - host
   viaqa.mobi conference on software testing - organizer
 
--
   Before posting, please readhttp://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
 
  --
  Lisa Crispin
  Co-author with Janet Gregory, _Agile Testing: A Practical Guide for
 Testers
  and Agile Teams_ (Addison-Wesley 2009)
  Contributor to _Beautiful Testing_ (O'Reilly 2009)http://lisacrispin.com
  @lisacrispin on Twitterhttp://entaggle.com/lisacrispin

 --
 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.comhttp://groups.google.com/group/watir-general%0awatir-general+unsubscr...@googlegroups.com




-- 
Lisa Crispin
Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers
and Agile Teams_ (Addison-Wesley 2009)
Contributor to _Beautiful Testing_ (O'Reilly 2009)
http://lisacrispin.com
@lisacrispin on Twitter
http://entaggle.com/lisacrispin




-- 
Lisa Crispin
Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers
and Agile Teams_ (Addison-Wesley 2009)
Contributor to _Beautiful Testing_ (O'Reilly 2009)
http://lisacrispin.com
@lisacrispin on Twitter
http://entaggle.com/lisacrispin

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com

Re: [wtr-general] Re: type-ahead select lists

2011-05-27 Thread Tim Koopmans
Hi Lisa, what's the code for selectPlanAdvisor();
Do? Might be worth just eval'ing that ...

Regards,
Tim 

Sent from my mobile ...


On 28/05/2011, at 6:05 AM, Lisa Crispin lisa.cris...@gmail.com wrote:

 (re-sending, I don't think it got sent for some reason)
 
 Now I am able to type text into the hidden field, but after looking at the 
 links Chuck recommended, the code from Paul, and lots of other Googling 
 around, I'm still flummoxed on trying to get the event to fire.
 
 Here is the html:
  select dojoType=dijit.form.FilteringSelect id='advisorId' 
 name='advisorId' onchange=javascript:selectPlanAdvisor();
 option value=0  selected 
 No Advisor
 /option
 option value=3785 
 FERNANDEZ, KEVIN S
 /option
 /select
 
 Here is what I've tried to try to fire the event:
  ie.hidden(:id, 'advisorId').fire_event(onchange)
 
 This returns a value of yellow in irb (WTF?) but does not fire the JS.
 
 One of the Java developers here tried to help, but he's as baffled as I am. 
 Any other suggestions? I will have many scripts broken because of this, and I 
 depend on those scripts to help with our exploratory testing as well as 
 testing releases to the staging environment. I don't want to lose them!
 
 thanks,
 Lisa
 
 
 On Thu, May 26, 2011 at 1:44 AM, Chuck van der Linden sqa...@gmail.com 
 wrote:
 I'd wager it's working off keypress events.  Problem is we can't
 easily fire those in watir because the .fire_event method only takes a
 single parameter (the event) and I believe to work properly keypress
 needs a parameter for the value of the key that was depressed.
 
 You might need to write your own function that executes the javascript
 fireevent function instead, similar to this item from Stackoverflow a
 year or two ago
 http://stackoverflow.com/questions/602069/autocomplete-dropdown-test-with-ruby-watir
 
 Another alternative is described here
 http://zbarzone.blogspot.com/2008/08/watir-sendkeys-and-javascript.html
 and that approach might actually be better for you.
 
 To fix this 'for real' it seems we'd need to first modify .fire_event
 to allow for a second parameter, or create a new method such
 as .fire_key_event  that would take two parameters.  Then any other
 methods that have keypress events in them such as .set would need to
 be altered to fire the down/press/up events character by character and
 fire those events with the proper 'key' values for each character.
 
 On May 24, 11:24 am, Lisa Crispin lisa.cris...@gmail.com wrote:
  I tried the log events thing, it's nice to know about that, but I don't see
  anything that really looks like the JS firing. I see a lot of 'select',
  'click' 'keydown', 'input', 'keypress', 'keyup', none of that looks like
  what the JS is doing with the type ahead.
  -- LIsa
 
  On Mon, May 23, 2011 at 2:36 PM, Željko Filipin 
 
 
 
 
 
 
 
 
 
  zeljko.fili...@wa-research.ch wrote:
   On Mon, May 23, 2011 at 9:44 PM, Lisa Crispin lisa.cris...@gmail.com
   wrote:
We are changing what used to be regular drop-down select list boxes to a
   dojo widget thingie that allows type ahead to select the item.
 
   Is the page public? Or a similar page? Frameworks usually have examples
   somewhere online.
 
   If you think the only problem is that a JavaScript event is not fired (by
   Watir), take a look at this:
 
  http://stackoverflow.com/questions/3787555/how-to-find-out-which-java...
 
   If the site is not public, but you could show it to me, contact me off
   list.
 
   Željko
   --
   watir.com - community manager
   watir.com/book - author
   watirpodcast.com - host
   viaqa.mobi conference on software testing - organizer
 
--
   Before posting, please readhttp://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
 
  --
  Lisa Crispin
  Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers
  and Agile Teams_ (Addison-Wesley 2009)
  Contributor to _Beautiful Testing_ (O'Reilly 2009)http://lisacrispin.com
  @lisacrispin on Twitterhttp://entaggle.com/lisacrispin
 
 --
 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
 
 
 
 -- 
 Lisa Crispin
 Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers 
 and Agile Teams_ (Addison-Wesley 2009)
 Contributor to _Beautiful Testing_ (O'Reilly 2009)
 http://lisacrispin.com
 @lisacrispin on Twitter
 http://entaggle.com/lisacrispin
 
 
 
 
 -- 
 Lisa Crispin
 Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers 
 and Agile Teams_ (Addison-Wesley 2009)
 Contributor to _Beautiful Testing_ (O'Reilly 2009)
 http://lisacrispin.com
 

[wtr-general] Re: type-ahead select lists

2011-05-26 Thread Chuck van der Linden
I'd wager it's working off keypress events.  Problem is we can't
easily fire those in watir because the .fire_event method only takes a
single parameter (the event) and I believe to work properly keypress
needs a parameter for the value of the key that was depressed.

You might need to write your own function that executes the javascript
fireevent function instead, similar to this item from Stackoverflow a
year or two ago
http://stackoverflow.com/questions/602069/autocomplete-dropdown-test-with-ruby-watir

Another alternative is described here
http://zbarzone.blogspot.com/2008/08/watir-sendkeys-and-javascript.html
and that approach might actually be better for you.

To fix this 'for real' it seems we'd need to first modify .fire_event
to allow for a second parameter, or create a new method such
as .fire_key_event  that would take two parameters.  Then any other
methods that have keypress events in them such as .set would need to
be altered to fire the down/press/up events character by character and
fire those events with the proper 'key' values for each character.

On May 24, 11:24 am, Lisa Crispin lisa.cris...@gmail.com wrote:
 I tried the log events thing, it's nice to know about that, but I don't see
 anything that really looks like the JS firing. I see a lot of 'select',
 'click' 'keydown', 'input', 'keypress', 'keyup', none of that looks like
 what the JS is doing with the type ahead.
 -- LIsa

 On Mon, May 23, 2011 at 2:36 PM, Željko Filipin 









 zeljko.fili...@wa-research.ch wrote:
  On Mon, May 23, 2011 at 9:44 PM, Lisa Crispin lisa.cris...@gmail.com
  wrote:
   We are changing what used to be regular drop-down select list boxes to a
  dojo widget thingie that allows type ahead to select the item.

  Is the page public? Or a similar page? Frameworks usually have examples
  somewhere online.

  If you think the only problem is that a JavaScript event is not fired (by
  Watir), take a look at this:

 http://stackoverflow.com/questions/3787555/how-to-find-out-which-java...

  If the site is not public, but you could show it to me, contact me off
  list.

  Željko
  --
  watir.com - community manager
  watir.com/book - author
  watirpodcast.com - host
  viaqa.mobi conference on software testing - organizer

   --
  Before posting, please readhttp://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

 --
 Lisa Crispin
 Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers
 and Agile Teams_ (Addison-Wesley 2009)
 Contributor to _Beautiful Testing_ (O'Reilly 2009)http://lisacrispin.com
 @lisacrispin on Twitterhttp://entaggle.com/lisacrispin

-- 
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


Re: [wtr-general] Re: type-ahead select lists

2011-05-26 Thread Paul Rogers
I have some code that I wrote about 3 years ago that does this. Ive
put it here, but Im not sure it would be much use as it is because of
the version of watir it was written against, and looking through it
appears to be IE only. Im afraid I dont have time to help out with it,
but if you can make something useful out of it, please do.

Hope it helps,

Paul




class EventInfo

# see http://msdn2.microsoft.com/en-us/library/ms533544(VS.85).aspx
LEFT_MOUSE = 1
RIGHT_MOUSE = 2
NO_MOUSE = 0

attr_accessor :clientX
attr_accessor :clientY
attr_accessor :screenX
attr_accessor :screenY
attr_accessor :x
attr_accessor :y
attr_accessor :expando
attr_accessor :ctrl_key
attr_accessor :shift_key
attr_accessor :alt_key
attr_accessor :mouse_button
attr_accessor :key_code


# these 2 are used to supply the id tags for events that start on
different objects
# ie we may fire the event on the document object, but we want
tthe src and target objects to be, for example divs
attr_accessor :target_element_id
attr_accessor :src_element_id


end


class Element
# Executes a user defined fireEvent for objects with JavaScript
events tied to them such as DHTML menus.
#   usage: allows a generic way to fire javascript events on page
objects such as onMouseOver, onClick, etc.
#   raises: UnknownObjectException  if the object is not found
#   ObjectDisabledException if the object is currently disabled
def fire_event(event  , extra_info=nil )
  #assert_enabled

  #highlight(:set)
  temp_id = nil
  if extra_info
  if self.id.nil? or self.id==
  temp_id = WatirTempID_ + Time.now.to_i.to_s
  self.ole_object[id]=temp_id
  end

  fire_event_with_extras( event , extra_info )

  else
  self.locate
  self.ole_object.fireEvent(event)
  end
  @container.wait
  #highlight(:clear)
end

def fire_event_with_extras( event , extra_info )
 raise Cant use event info unless target elment has an id if
self.id.nil? or self.id==

 src_element_string = target
 src_element_string =
document.getElementById('#{extra_info.src_element_id}') if
extra_info.src_element_id

 #puts src_element_string = 
 #puts src_element_string
 #puts --

js=-end_js
e=document.createEventObject()
// these seem to be ignored, and clientX and clientY
values get used in their place
e.x =#{extra_info.x || 0};
e.y=#{extra_info.y  || 0};


e.clientX = #{extra_info.clientX || 0 };
e.clientY = #{extra_info.clientY || 0 };

e.screenX = #{extra_info.screenX  || 0 };
e.screenY = #{extra_info.screenY  || 0 };


e.expando=#{extra_info.expando};

e.ctrlKey=#{extra_info.ctrl_key || false };
e.altKey=#{extra_info.alt_key   || false };
e.shiftKey=#{extra_info.shift_key || false};

e.button=#{extra_info.mouse_button || 0 };
e.keyCode=#{extra_info.key_code|| 0 };

target=  document.getElementById('#{self.id}');
e.srcElement =  target;
e.fromElement = target;
e.toElement = target;
//e.relatedTarget = target;
e.target = target;

//alert( before:  + e.clientX +   + e.clientY  +   
+ e.srcElement ++ e.fromElement ++  e.toElement );
target.fireEvent('#{event}' , e );
//alert( after:   + e.relatedTarget  + e.clientX +   +
e.clientY  ++ e.srcElement ++ e.fromElement ++
e.toElement );

end_js
#puts  js
ole_object.ownerDocument.parentWindow.execScript( js )

end
private :fire_event_with_extras
end




On Thu, May 26, 2011 at 1:44 AM, Chuck van der Linden sqa...@gmail.com wrote:
 I'd wager it's working off keypress events.  Problem is we can't
 easily fire those in watir because the .fire_event method only takes a
 single parameter (the event) and I believe to work properly keypress
 needs a parameter for the value of the key that was depressed.

 You might need to write your own function that executes the javascript
 fireevent function instead, similar to this item from Stackoverflow a
 year or two ago    
 http://stackoverflow.com/questions/602069/autocomplete-dropdown-test-with-ruby-watir

 Another alternative is described here
 http://zbarzone.blogspot.com/2008/08/watir-sendkeys-and-javascript.html
 and that approach might actually be better for you.

 To fix this 'for real' it seems we'd need to first modify .fire_event
 to allow for a second parameter, or create a new method such
 as .fire_key_event  that would take two parameters.  Then any other
 methods that have keypress events in them such as .set would need to
 be altered to fire the down/press/up events character by character and
 fire those events with 

Re: [wtr-general] Re: type-ahead select lists

2011-05-26 Thread Lisa Crispin
Thanks, Paul. I think, though, that my main problem is the field is hidden,
and I can't figure out the Watir syntax to force a hidden input field.
-- Lisa

On Thu, May 26, 2011 at 9:51 AM, Paul Rogers paul.rog...@shaw.ca wrote:

 I have some code that I wrote about 3 years ago that does this. Ive
 put it here, but Im not sure it would be much use as it is because of
 the version of watir it was written against, and looking through it
 appears to be IE only. Im afraid I dont have time to help out with it,
 but if you can make something useful out of it, please do.

 Hope it helps,

 Paul




 class EventInfo

# see http://msdn2.microsoft.com/en-us/library/ms533544(VS.85).aspx
LEFT_MOUSE = 1
RIGHT_MOUSE = 2
NO_MOUSE = 0

attr_accessor :clientX
attr_accessor :clientY
attr_accessor :screenX
attr_accessor :screenY
attr_accessor :x
attr_accessor :y
attr_accessor :expando
attr_accessor :ctrl_key
attr_accessor :shift_key
attr_accessor :alt_key
attr_accessor :mouse_button
attr_accessor :key_code


# these 2 are used to supply the id tags for events that start on
 different objects
# ie we may fire the event on the document object, but we want
 tthe src and target objects to be, for example divs
attr_accessor :target_element_id
attr_accessor :src_element_id


 end


 class Element
# Executes a user defined fireEvent for objects with JavaScript
 events tied to them such as DHTML menus.
#   usage: allows a generic way to fire javascript events on page
 objects such as onMouseOver, onClick, etc.
#   raises: UnknownObjectException  if the object is not found
#   ObjectDisabledException if the object is currently disabled
def fire_event(event  , extra_info=nil )
  #assert_enabled

  #highlight(:set)
  temp_id = nil
  if extra_info
  if self.id.nil? or self.id==
  temp_id = WatirTempID_ + Time.now.to_i.to_s
  self.ole_object[id]=temp_id
  end

  fire_event_with_extras( event , extra_info )

  else
  self.locate
  self.ole_object.fireEvent(event)
  end
  @container.wait
  #highlight(:clear)
end

def fire_event_with_extras( event , extra_info )
 raise Cant use event info unless target elment has an id if
 self.id.nil? or self.id==

 src_element_string = target
 src_element_string =
 document.getElementById('#{extra_info.src_element_id}') if
 extra_info.src_element_id

 #puts src_element_string = 
 #puts src_element_string
 #puts --

js=-end_js
e=document.createEventObject()
// these seem to be ignored, and clientX and clientY
 values get used in their place
e.x =#{extra_info.x || 0};
e.y=#{extra_info.y  || 0};


e.clientX = #{extra_info.clientX || 0 };
e.clientY = #{extra_info.clientY || 0 };

e.screenX = #{extra_info.screenX  || 0 };
e.screenY = #{extra_info.screenY  || 0 };


e.expando=#{extra_info.expando};

e.ctrlKey=#{extra_info.ctrl_key || false };
e.altKey=#{extra_info.alt_key   || false };
e.shiftKey=#{extra_info.shift_key || false};

e.button=#{extra_info.mouse_button || 0 };
e.keyCode=#{extra_info.key_code|| 0 };

target=  document.getElementById('#{self.id}');
e.srcElement =  target;
e.fromElement = target;
e.toElement = target;
//e.relatedTarget = target;
e.target = target;

//alert( before:  + e.clientX +   + e.clientY  +   
 + e.srcElement ++ e.fromElement ++  e.toElement );
target.fireEvent('#{event}' , e );
//alert( after:   + e.relatedTarget  + e.clientX +   +
 e.clientY  ++ e.srcElement ++ e.fromElement ++
 e.toElement );

end_js
#puts  js
ole_object.ownerDocument.parentWindow.execScript( js )

end
private :fire_event_with_extras
 end




 On Thu, May 26, 2011 at 1:44 AM, Chuck van der Linden sqa...@gmail.com
 wrote:
  I'd wager it's working off keypress events.  Problem is we can't
  easily fire those in watir because the .fire_event method only takes a
  single parameter (the event) and I believe to work properly keypress
  needs a parameter for the value of the key that was depressed.
 
  You might need to write your own function that executes the javascript
  fireevent function instead, similar to this item from Stackoverflow a
  year or two ago
 http://stackoverflow.com/questions/602069/autocomplete-dropdown-test-with-ruby-watir
 
  Another alternative is described here
  http://zbarzone.blogspot.com/2008/08/watir-sendkeys-and-javascript.html
  and that approach might actually be better for you.
 
  To fix this 'for real' it seems we'd need to first modify .fire_event
  to allow for a second parameter, 

Re: [wtr-general] Re: type-ahead select lists

2011-05-26 Thread Željko Filipin
On Thu, May 26, 2011 at 7:05 PM, Lisa Crispin lisa.cris...@gmail.com
wrote:
 my main problem is the field is hidden, and I can't figure out the Watir
syntax to force a hidden input field.

Watir can work with hidden fields:

browser.hidden(how, what)

More info:

http://wiki.openqa.org/display/WTR/HTML+Elements+Supported+by+Watir

(This will not work in watir-webdriver.)

Željko

-- 
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


Re: [wtr-general] Re: type-ahead select lists

2011-05-26 Thread Lisa Crispin
Thanks, I will take a look!
-- Lisa

On Thu, May 26, 2011 at 11:10 AM, Željko Filipin 
zeljko.fili...@wa-research.ch wrote:

 On Thu, May 26, 2011 at 7:05 PM, Lisa Crispin lisa.cris...@gmail.com
 wrote:
  my main problem is the field is hidden, and I can't figure out the Watir
 syntax to force a hidden input field.

 Watir can work with hidden fields:

 browser.hidden(how, what)

 More info:

 http://wiki.openqa.org/display/WTR/HTML+Elements+Supported+by+Watir

 (This will not work in watir-webdriver.)

 Željko

 --
 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




-- 
Lisa Crispin
Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers
and Agile Teams_ (Addison-Wesley 2009)
Contributor to _Beautiful Testing_ (O'Reilly 2009)
http://lisacrispin.com
@lisacrispin on Twitter
http://entaggle.com/lisacrispin

-- 
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


Re: [wtr-general] Re: type-ahead select lists

2011-05-26 Thread Lisa Crispin
OK, I got the hidden part to work, but I do need the fire event, I think. I
wish I knew how this is so easily done in Canoo WebTest with the
forceHiddenInputField. Not being a programmer, I am thinking I'm not going
to be able to figure this out. The Java programmers here aren't too keen to
help me but maybe I can get one of them to, I'm sure they could figure it
out with all the info y'all have provided. Thanks.
-- Lisa

On Thu, May 26, 2011 at 1:44 AM, Chuck van der Linden sqa...@gmail.comwrote:

 I'd wager it's working off keypress events.  Problem is we can't
 easily fire those in watir because the .fire_event method only takes a
 single parameter (the event) and I believe to work properly keypress
 needs a parameter for the value of the key that was depressed.

 You might need to write your own function that executes the javascript
 fireevent function instead, similar to this item from Stackoverflow a
 year or two ago
 http://stackoverflow.com/questions/602069/autocomplete-dropdown-test-with-ruby-watir

 Another alternative is described here
 http://zbarzone.blogspot.com/2008/08/watir-sendkeys-and-javascript.html
 and that approach might actually be better for you.

 To fix this 'for real' it seems we'd need to first modify .fire_event
 to allow for a second parameter, or create a new method such
 as .fire_key_event  that would take two parameters.  Then any other
 methods that have keypress events in them such as .set would need to
 be altered to fire the down/press/up events character by character and
 fire those events with the proper 'key' values for each character.

 On May 24, 11:24 am, Lisa Crispin lisa.cris...@gmail.com wrote:
  I tried the log events thing, it's nice to know about that, but I don't
 see
  anything that really looks like the JS firing. I see a lot of 'select',
  'click' 'keydown', 'input', 'keypress', 'keyup', none of that looks like
  what the JS is doing with the type ahead.
  -- LIsa
 
  On Mon, May 23, 2011 at 2:36 PM, Željko Filipin 
 
 
 
 
 
 
 
 
 
  zeljko.fili...@wa-research.ch wrote:
   On Mon, May 23, 2011 at 9:44 PM, Lisa Crispin lisa.cris...@gmail.com
   wrote:
We are changing what used to be regular drop-down select list boxes
 to a
   dojo widget thingie that allows type ahead to select the item.
 
   Is the page public? Or a similar page? Frameworks usually have examples
   somewhere online.
 
   If you think the only problem is that a JavaScript event is not fired
 (by
   Watir), take a look at this:
 
  http://stackoverflow.com/questions/3787555/how-to-find-out-which-java.
 ..
 
   If the site is not public, but you could show it to me, contact me off
   list.
 
   Željko
   --
   watir.com - community manager
   watir.com/book - author
   watirpodcast.com - host
   viaqa.mobi conference on software testing - organizer
 
--
   Before posting, please readhttp://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
 
  --
  Lisa Crispin
  Co-author with Janet Gregory, _Agile Testing: A Practical Guide for
 Testers
  and Agile Teams_ (Addison-Wesley 2009)
  Contributor to _Beautiful Testing_ (O'Reilly 2009)http://lisacrispin.com
  @lisacrispin on Twitterhttp://entaggle.com/lisacrispin

 --
 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.comhttp://groups.google.com/group/watir-general%0awatir-general+unsubscr...@googlegroups.com




-- 
Lisa Crispin
Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers
and Agile Teams_ (Addison-Wesley 2009)
Contributor to _Beautiful Testing_ (O'Reilly 2009)
http://lisacrispin.com
@lisacrispin on Twitter
http://entaggle.com/lisacrispin

-- 
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


Re: [wtr-general] Re: type-ahead select lists

2011-05-26 Thread Lisa Crispin
Now I am able to type text into the hidden field, but after looking at the
links Chuck recommended, the code from Paul, and lots of other Googling
around, I'm still flummoxed on trying to get the event to fire.

Here is the html:
 select dojoType=dijit.form.FilteringSelect id='advisorId'
name='advisorId' onchange=javascript:selectPlanAdvisor();
option value=0  selected 
No Advisor
/option
option value=3785 
FERNANDEZ, KEVIN S
/option
/select

Here is what I've tried to try to fire the event:
 ie.hidden(:id, 'advisorId').fire_event(onchange)

This returns a value of yellow in irb (WTF?) but does not fire the JS.

One of the Java developers here tried to help, but he's as baffled as I am.
Any other suggestions? I will have many scripts broken because of this, and
I depend on those scripts to help with our exploratory testing as well as
testing releases to the staging environment. I don't want to lose them!

thanks,
Lisa


On Thu, May 26, 2011 at 1:44 AM, Chuck van der Linden sqa...@gmail.comwrote:

 I'd wager it's working off keypress events.  Problem is we can't
 easily fire those in watir because the .fire_event method only takes a
 single parameter (the event) and I believe to work properly keypress
 needs a parameter for the value of the key that was depressed.

 You might need to write your own function that executes the javascript
 fireevent function instead, similar to this item from Stackoverflow a
 year or two ago
 http://stackoverflow.com/questions/602069/autocomplete-dropdown-test-with-ruby-watir

 Another alternative is described here
 http://zbarzone.blogspot.com/2008/08/watir-sendkeys-and-javascript.html
 and that approach might actually be better for you.

 To fix this 'for real' it seems we'd need to first modify .fire_event
 to allow for a second parameter, or create a new method such
 as .fire_key_event  that would take two parameters.  Then any other
 methods that have keypress events in them such as .set would need to
 be altered to fire the down/press/up events character by character and
 fire those events with the proper 'key' values for each character.

 On May 24, 11:24 am, Lisa Crispin lisa.cris...@gmail.com wrote:
  I tried the log events thing, it's nice to know about that, but I don't
 see
  anything that really looks like the JS firing. I see a lot of 'select',
  'click' 'keydown', 'input', 'keypress', 'keyup', none of that looks like
  what the JS is doing with the type ahead.
  -- LIsa
 
  On Mon, May 23, 2011 at 2:36 PM, Željko Filipin 
 
 
 
 
 
 
 
 
 
  zeljko.fili...@wa-research.ch wrote:
   On Mon, May 23, 2011 at 9:44 PM, Lisa Crispin lisa.cris...@gmail.com
   wrote:
We are changing what used to be regular drop-down select list boxes
 to a
   dojo widget thingie that allows type ahead to select the item.
 
   Is the page public? Or a similar page? Frameworks usually have examples
   somewhere online.
 
   If you think the only problem is that a JavaScript event is not fired
 (by
   Watir), take a look at this:
 
  http://stackoverflow.com/questions/3787555/how-to-find-out-which-java.
 ..
 
   If the site is not public, but you could show it to me, contact me off
   list.
 
   Željko
   --
   watir.com - community manager
   watir.com/book - author
   watirpodcast.com - host
   viaqa.mobi conference on software testing - organizer
 
--
   Before posting, please readhttp://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
 
  --
  Lisa Crispin
  Co-author with Janet Gregory, _Agile Testing: A Practical Guide for
 Testers
  and Agile Teams_ (Addison-Wesley 2009)
  Contributor to _Beautiful Testing_ (O'Reilly 2009)http://lisacrispin.com
  @lisacrispin on Twitterhttp://entaggle.com/lisacrispin

 --
 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.comhttp://groups.google.com/group/watir-general%0awatir-general+unsubscr...@googlegroups.com




-- 
Lisa Crispin
Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers
and Agile Teams_ (Addison-Wesley 2009)
Contributor to _Beautiful Testing_ (O'Reilly 2009)
http://lisacrispin.com
@lisacrispin on Twitter
http://entaggle.com/lisacrispin

-- 
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


Re: [wtr-general] Re: type-ahead select lists

2011-05-26 Thread Jari Bakken
On Thu, May 26, 2011 at 7:10 PM, Željko Filipin
zeljko.fili...@wa-research.ch wrote:
 Watir can work with hidden fields:

 browser.hidden(how, what)

[...]

 (This will not work in watir-webdriver.)


Actually, that code will work, and you can also interact with it to
some degree (e.g. getting attributes). What WebDriver doesn't allow is
calling #set or #value= on fields that aren't visible to the user.

-- 
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


[wtr-general] Re: type-ahead select lists

2011-05-23 Thread George
Hi Lisa,

I think I found an example you're using here:

http://www.upscale.utoronto.ca/test/dojo/tests/widget/test_Select.html

I'm looking at Select #2 (dataUrl, autocomplete=true). The only way I
could get it to work is by using send_keys:

b = Watir::IE.attach(:title, /Dojo/)
test_field = b.span(:class = dojoComboBoxOuter dj_ie, :index =
2).text_field(:class, dojoComboBox)
test_field.focus
b.send_keys(florida)
sleep 2
b.send_keys({ENTER})


On May 23, 12:44 pm, Lisa Crispin lisa.cris...@gmail.com wrote:
 We are changing what used to be regular drop-down select list boxes to a
 dojo widget thingie that allows type ahead to select the item. Here's the
 HTML:

     select dojoType=dijit.form.FilteringSelect id=advisor.dealerId
 name=advisor.dealerId style='width: 550px;'

                     option value=0 

             /option

                     option value=1059 
                 1717 Capital Management / 300 Continental Drive /
 Suite 3 South / Newark, DE 19713-4329 /

             /option
 ...etc

 I thought I could use text_field to set a value here, just as if I typed it
 manually on the page. I tried ie.text_field(:id,
 'advisor.dealerId').set(some value). When I do this in irb, I see it set
 the value, but when I submit, it shows the default value was selected
 instead. I also tried fire_event(onclick), that didn't help.

 We were able to get our Canoo WebTest scripts to select these with its
 forceHiddenInputField step. I thought maybe I could do something similar
 in Watir with input type=hidden, but I can't get the syntax right and I
 can't find any examples. I can't figure out where I would put input
 type=hidden in my text_field step.

 Would someone please point me to examples that might help me figure this
 out? I apologize if this is an ignorant question. I searched the mailing
 list and the Watir site but I could not figure out how to make this work.
 thanks,
 Lisa

 --
 Lisa Crispin
 Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers
 and Agile Teams_ (Addison-Wesley 2009)
 Contributor to _Beautiful Testing_ (O'Reilly 2009)http://lisacrispin.com
 @lisacrispin on Twitterhttp://entaggle.com/lisacrispin

-- 
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


Re: [wtr-general] Re: type-ahead select lists

2011-05-23 Thread Lisa Crispin
Wow, I never even heard of send_keys, I'll give it a try, thank you.
-- Lisa

On Mon, May 23, 2011 at 3:26 PM, George george.sand...@gmail.com wrote:

 Hi Lisa,

 I think I found an example you're using here:

 http://www.upscale.utoronto.ca/test/dojo/tests/widget/test_Select.html

 I'm looking at Select #2 (dataUrl, autocomplete=true). The only way I
 could get it to work is by using send_keys:

 b = Watir::IE.attach(:title, /Dojo/)
 test_field = b.span(:class = dojoComboBoxOuter dj_ie, :index =
 2).text_field(:class, dojoComboBox)
 test_field.focus
 b.send_keys(florida)
 sleep 2
 b.send_keys({ENTER})


 On May 23, 12:44 pm, Lisa Crispin lisa.cris...@gmail.com wrote:
  We are changing what used to be regular drop-down select list boxes to a
  dojo widget thingie that allows type ahead to select the item. Here's the
  HTML:
 
  select dojoType=dijit.form.FilteringSelect id=advisor.dealerId
  name=advisor.dealerId style='width: 550px;'
 
  option value=0 
 
  /option
 
  option value=1059 
  1717 Capital Management / 300 Continental Drive /
  Suite 3 South / Newark, DE 19713-4329 /
 
  /option
  ...etc
 
  I thought I could use text_field to set a value here, just as if I typed
 it
  manually on the page. I tried ie.text_field(:id,
  'advisor.dealerId').set(some value). When I do this in irb, I see it
 set
  the value, but when I submit, it shows the default value was selected
  instead. I also tried fire_event(onclick), that didn't help.
 
  We were able to get our Canoo WebTest scripts to select these with its
  forceHiddenInputField step. I thought maybe I could do something
 similar
  in Watir with input type=hidden, but I can't get the syntax right and I
  can't find any examples. I can't figure out where I would put input
  type=hidden in my text_field step.
 
  Would someone please point me to examples that might help me figure this
  out? I apologize if this is an ignorant question. I searched the mailing
  list and the Watir site but I could not figure out how to make this work.
  thanks,
  Lisa
 
  --
  Lisa Crispin
  Co-author with Janet Gregory, _Agile Testing: A Practical Guide for
 Testers
  and Agile Teams_ (Addison-Wesley 2009)
  Contributor to _Beautiful Testing_ (O'Reilly 2009)http://lisacrispin.com
  @lisacrispin on Twitterhttp://entaggle.com/lisacrispin

 --
 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.comhttp://groups.google.com/group/watir-general%0awatir-general+unsubscr...@googlegroups.com




-- 
Lisa Crispin
Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers
and Agile Teams_ (Addison-Wesley 2009)
Contributor to _Beautiful Testing_ (O'Reilly 2009)
http://lisacrispin.com
@lisacrispin on Twitter
http://entaggle.com/lisacrispin

-- 
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