[wtr-general] Re: Overiding onclick javascript

2009-03-13 Thread Andy Sipe
Using this html file: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/TR/html4/strict.dtd; html head titleSample/title script type=text/javascript function doSomething(e) { alert('inside preexisting hanlder'); alert((window.event ? '' : 'not ') +

[wtr-general] Re: Overiding onclick javascript

2009-03-13 Thread andrew . dahl
What follows is a working solution and some lessons learned in handling popups. Thanks for everyone that has helped along the way. I needed to handle confirmation popups. After trying autoit based solutions without success, I decided to try a solution that has worked for me in the past -

[wtr-general] Re: Overiding onclick javascript

2009-03-13 Thread Charley Baker
Andrew, Here's a link to Paul's event code, the files are on the attachments tab. http://wiki.openqa.org/display/WTR/Possibilities+For+New+Events+in+Watir hth, Charley Baker blog: http://blog.charleybaker.org/ Lead Developer, Watir, http://wtr.rubyforge.org QA Architect, Gap Inc Direct

[wtr-general] Re: Overiding onclick javascript

2009-03-12 Thread Andy Sipe
Take a look at this W3 schools link, it may help: http://www.w3schools.com/jsref/jsref_onkeypress.asp Note how they pass the event from the link: onmousedown=getEventTrigger(event) vs onmousedown=getEventTrigger() Maybe that will help - andy On Thu, Mar 12, 2009 at 1:06 PM,

[wtr-general] Re: Overiding onclick javascript

2009-03-12 Thread andrew . dahl
Yea, I've tried passing it as a parm with no luck also. Everything says it is supposed to work, but I can't get it. On Mar 12, 12:11 pm, Andy Sipe ajs.gene...@gmail.com wrote: Take a look at this W3 schools link, it may help:http://www.w3schools.com/jsref/jsref_onkeypress.asp Note how they

[wtr-general] Re: Overiding onclick javascript

2009-03-12 Thread Paul Rogers
I cant do much until I get back - middle of next week. I can try and help then Paul On Thu, Mar 12, 2009 at 3:36 PM, Charley Baker charley.ba...@gmail.comwrote: Paul Rogers put some event code on the wiki, I haven't used it but looked at it and it might give you a better approach for js

[wtr-general] Re: Overiding onclick javascript

2009-03-11 Thread Andy Sipe
You should be able to read it using xpath or some other technique. I don't believe you can set it directly with watir. However you can always inject javascript that will change the handler. Something like: @ie.Document.parentWindow.execScript($('eleid').onclick = 'alert('hi');'); I didn't

[wtr-general] Re: Overiding onclick javascript

2009-03-11 Thread andrew . dahl
When I tried this I got undefined method `Document' for #Watir::IE:0x4288648 (NoMethodError) Is Watir::IE the correct object to be using here? On Mar 11, 8:53 am, Andy Sipe ajs.gene...@gmail.com wrote: You should be able to read it using xpath or some other technique. I don't believe

[wtr-general] Re: Overiding onclick javascript

2009-03-11 Thread Andy Sipe
lower case 'd' @ie.document Sorry about that. -andy On Wed, Mar 11, 2009 at 11:02 AM, andrew.d...@lthree.com wrote: When I tried this I got undefined method `Document' for #Watir::IE:0x4288648 (NoMethodError) Is Watir::IE the correct object to be using here? On Mar 11, 8:53

[wtr-general] Re: Overiding onclick javascript

2009-03-11 Thread andrew . dahl
Here is a sample. This code does not throw any exceptions. js1,2,3 all result in a popup. js 4 does not - indicating that it is not finding the element I want. I gaurantee that the html element I am looking for is a child of top_frame. In fact, the code that calls this block checks that the html