On Apr 8, 5:26 am, Jarmo Pertman <jarm...@gmail.com> wrote:
> As I understand, then onfocus event is require prior clicking
> something? So for example, if uses clicks with mouse, then onfocus
> event is triggered before actual click?

I don't belive it's 'required'  or the .click method would not work at
all, and for most of us it works quite well.

Actually I believe that when the user clicks the mouse in the UI there
are a series of events that the browser fires off
focus, mousedown, mouseup, click   These are not 'required' they are
merely what happens.  how the UI reacts will depend on which of these
methods have been implemented for a given element in the client side
javascript, and/or what kind fo element you are clicking on

There's also I believe a time proximity between the mousedown and
mouseup that is required for an actual click event to be issued.

Brett can correct me if I'm remembering right but I seem to recall he
said that Watir is firing off mouseup when the click method is used.

>
> Is this the reason, why at the moment I have to do something like this
> in my tests to work correctly:
> button.click
> button.fire_event("onclick")
>
> So, if .click method would do fire_event("onfocus") before clicking
> itself, then I wouldn't have to specifically call .fire_event
> ("onclick") method itself but it would be called like normally happens
> with manual interaction?
>
> What about text_field and select_list "onchange" event? It seems that
> they aren't triggered by Watir either. At the moment I'm just changing
> text_field value and then firing onchange event manually. Why not make
> it to trigger automatically also?

Perhaps because a lot of sites don't take any action when the
selection in a selection list is changed, so the code works just fine
in a majority of cases without doing this.

OTOH in terms of fooling the system to think there's really a user out
there at the other end of the mouse, it might not be a bad idea to
consider firing off all the events that would normally happen when a
user manually selects something from a selection list.

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

Reply via email to