[wtr-general] Re: Difference between fire_event("click") and element.click

2009-04-10 Thread Bret Pettichord

Jarmo,

Watir should issue the same events as would be generated by a real user. 
As we've found one's we missed, we've added them.

We've never systematically identified the events that should be 
generated. It would be great if someone would do this.

If Watir is missing specific events, that is a bug. A patch to fix the 
events you've found missing would be welcome.

Bret

Jarmo Pertman 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?
>
> 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?
>
> Jarmo

-- 
Bret Pettichord
CTO, WatirCraft LLC, www.watircraft.com
Lead Developer, Watir, www.watir.com
Blog, www.io.com/~wazmo/blog
Twitter, www.twitter.com/bpettichord

Watir Training: Portland/Beaverton April 16-17
www.watircraft.com/training


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



[wtr-general] Re: Difference between fire_event("click") and element.click

2009-04-08 Thread Chuck van der Linden

On Apr 8, 5:26 am, Jarmo Pertman  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
-~--~~~~--~~--~--~---



[wtr-general] Re: Difference between fire_event("click") and element.click

2009-04-08 Thread Jarmo Pertman

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?

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?

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



[wtr-general] Re: Difference between fire_event("click") and element.click

2009-03-30 Thread Bret Pettichord

Angrez Singh wrote:
> Thanks Paul for the information. Just going through it found that
>
> "If the user clicks an object that can receive the input focus but 
> does not already have the focus, the onfocus 
>  
> event occurs for that object before the *onclick* event. "
>
> In my case when I used click "onfocus" event was not getting raised. 
> When i explicitly fired "onfocus" event on link and then used 
> link.click() i was able to get the desired results.
>
> My question now is, does watir fires "onfocus" event before clicking 
> an element? If not, then do we need to change it?

Sounds reasonable.

-- 
Bret Pettichord
CTO, WatirCraft LLC, www.watircraft.com
Lead Developer, Watir, www.watir.com
Blog, www.io.com/~wazmo/blog
Twitter, www.twitter.com/bpettichord

Watir Training: Portland/Beaverton April 16-17
www.watircraft.com/training


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



[wtr-general] Re: Difference between fire_event("click") and element.click

2009-03-30 Thread Paul Rogers
glad I could help!
as to wether it needs to be changed - no idea.

Paul


On Mon, Mar 30, 2009 at 10:46 AM, Angrez Singh  wrote:

> Thanks Paul for the information. Just going through it found that
>
> "If the user clicks an object that can receive the input focus but does not
> already have the focus, the 
> onfocusevent
>  occurs for that object before the
> *onclick* event. "
>
> In my case when I used click "onfocus" event was not getting raised. When i
> explicitly fired "onfocus" event on link and then used link.click() i was
> able to get the desired results.
>
> My question now is, does watir fires "onfocus" event before clicking an
> element? If not, then do we need to change it?
>
> - Angrez
>
>
> On Mon, Mar 30, 2009 at 9:01 PM, Paul Rogers  wrote:
>
>> the javascript is probably needing the event object to work correctly. The
>> dom click method generates a click event, but does not add the associated
>> event object, so it works fine for simple things like Google
>>
>> The fire_event('onClick') does essentially the same thing,
>>
>> ( 
>> http://msdn.microsoft.com/en-us/library/ms536913(VS.85).aspx
>> for onclick event)
>> ( 
>> http://msdn.microsoft.com/en-us/library/ms536363(VS.85).aspx
>> for click method )
>>
>> for more advanced uses, the event object is used. Ive been trying to get
>> this added to watir but just havent had time. As we get richer user
>> interfaces, especially ones using the common libraries like jquery this is
>> going to become more important.
>>
>> Paul
>>
>>
>>
>>
>> On Mon, Mar 30, 2009 at 7:58 AM, Angrez Singh  wrote:
>>
>>> I am facing a weird problem
>>>
>>> if I click the link manually then i get the desired results but if I use
>>> link.click() then i get javascript errors. Link has href() which points to
>>> some javascript method
>>>
>>> 
>>>
>>> Any ideas? or suggestions? to fire the javascript event successfully
>>> using watir?
>>>
>>> - Angrez
>>>
>>>
>>> On Mon, Mar 30, 2009 at 7:20 PM, Angrez Singh  wrote:
>>>
 Hi,

 Can some one explain me the difference? In one of our projects if I do
 link.click() i get javascript errors & if i do link.fire_event("onclick")
 nothing happens.

 - Angrez

>>>
>>>
>>>
>>>
>>
>>
>>
>
> >
>

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



[wtr-general] Re: Difference between fire_event("click") and element.click

2009-03-30 Thread Angrez Singh
Thanks Paul for the information. Just going through it found that

"If the user clicks an object that can receive the input focus but does not
already have the focus, the
onfocusevent
occurs for that object before the
*onclick* event. "

In my case when I used click "onfocus" event was not getting raised. When i
explicitly fired "onfocus" event on link and then used link.click() i was
able to get the desired results.

My question now is, does watir fires "onfocus" event before clicking an
element? If not, then do we need to change it?

- Angrez

On Mon, Mar 30, 2009 at 9:01 PM, Paul Rogers  wrote:

> the javascript is probably needing the event object to work correctly. The
> dom click method generates a click event, but does not add the associated
> event object, so it works fine for simple things like Google
>
> The fire_event('onClick') does essentially the same thing,
>
> ( 
> http://msdn.microsoft.com/en-us/library/ms536913(VS.85).aspx
> for onclick event)
> ( 
> http://msdn.microsoft.com/en-us/library/ms536363(VS.85).aspx
> for click method )
>
> for more advanced uses, the event object is used. Ive been trying to get
> this added to watir but just havent had time. As we get richer user
> interfaces, especially ones using the common libraries like jquery this is
> going to become more important.
>
> Paul
>
>
>
>
> On Mon, Mar 30, 2009 at 7:58 AM, Angrez Singh  wrote:
>
>> I am facing a weird problem
>>
>> if I click the link manually then i get the desired results but if I use
>> link.click() then i get javascript errors. Link has href() which points to
>> some javascript method
>>
>> 
>>
>> Any ideas? or suggestions? to fire the javascript event successfully using
>> watir?
>>
>> - Angrez
>>
>>
>> On Mon, Mar 30, 2009 at 7:20 PM, Angrez Singh  wrote:
>>
>>> Hi,
>>>
>>> Can some one explain me the difference? In one of our projects if I do
>>> link.click() i get javascript errors & if i do link.fire_event("onclick")
>>> nothing happens.
>>>
>>> - Angrez
>>>
>>
>>
>>
>>
>
> >
>

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



[wtr-general] Re: Difference between fire_event("click") and element.click

2009-03-30 Thread Paul Rogers
the javascript is probably needing the event object to work correctly. The
dom click method generates a click event, but does not add the associated
event object, so it works fine for simple things like Google

The fire_event('onClick') does essentially the same thing,

( http://msdn.microsoft.com/en-us/library/ms536913(VS.85).aspx   for onclick
event)
( http://msdn.microsoft.com/en-us/library/ms536363(VS.85).aspx   for click
method )

for more advanced uses, the event object is used. Ive been trying to get
this added to watir but just havent had time. As we get richer user
interfaces, especially ones using the common libraries like jquery this is
going to become more important.

Paul



On Mon, Mar 30, 2009 at 7:58 AM, Angrez Singh  wrote:

> I am facing a weird problem
>
> if I click the link manually then i get the desired results but if I use
> link.click() then i get javascript errors. Link has href() which points to
> some javascript method
>
> 
>
> Any ideas? or suggestions? to fire the javascript event successfully using
> watir?
>
> - Angrez
>
>
> On Mon, Mar 30, 2009 at 7:20 PM, Angrez Singh  wrote:
>
>> Hi,
>>
>> Can some one explain me the difference? In one of our projects if I do
>> link.click() i get javascript errors & if i do link.fire_event("onclick")
>> nothing happens.
>>
>> - Angrez
>>
>
>
> >
>

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



[wtr-general] Re: Difference between fire_event("click") and element.click

2009-03-30 Thread Angrez Singh
I am facing a weird problem

if I click the link manually then i get the desired results but if I use
link.click() then i get javascript errors. Link has href() which points to
some javascript method



Any ideas? or suggestions? to fire the javascript event successfully using
watir?

- Angrez

On Mon, Mar 30, 2009 at 7:20 PM, Angrez Singh  wrote:

> Hi,
>
> Can some one explain me the difference? In one of our projects if I do
> link.click() i get javascript errors & if i do link.fire_event("onclick")
> nothing happens.
>
> - Angrez
>

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