sorry forgot to mention that it is working in firebug. So I am not sure why it is not workin in FireWatir
On Jan 8, 6:34 pm, sai <saidesertrose2...@gmail.com> wrote: > I tried this > require 'firewatir' > > class Element > def close_js_confirm > assert_exist > @container.js_eval("window.confirm = function(){return true;}") > sleep 1 > end > end > > ff = FireWatir::Firefox.new > ff.goto("http://www.w3schools.com/JS/tryit.asp? > filename=tryjs_confirm") > ff.frame(:name, "view").button(:value, "Display a confirm > box").close_js_confirm > ff.frame(:name, "view").button(:value, "Display a confirm box").click > > But it is not working for me. I tried the same js in firebug > navigating to that frame but in vain :( > > Any ideas? > > Regards, > Sai > > On Jan 8, 6:03 pm, "aidy lewis" <aidy.le...@googlemail.com> wrote: > > > > > The trouble however with this method is that we will never know if it > > executes the js or not or does what it is supposed to do. > > > Aidy > > > 2009/1/8 aidy lewis <aidy.le...@googlemail.com>: > > > > Hi Tony, > > > > Certainly works, even though I have changed #click_no_wait to #click. > > > > I think we need to put this example in the js pop-up wiki and we need > > > an example for alerts as well. > > > > For Firewatir you could re-open the FireWatir class and use > > > #$jssh_socket.send > > > > class FireWatir::Firefox > > > def close_js_confirm > > > $jssh_socket.send("[js]\n", 0) > > > self.read_socket() > > > sleep 1 > > > end > > > end > > > > Aidy > > > > 2009/1/8 Tony <ynot...@gmail.com>: > > > >> Hi Aidy, > > > >> Got the error - > > >> The problem is the script disp_confirm is being called from a frame, > > >> and its this frames disp_confirm and window_confirm, that should be > > >> overridden. > > >> So this should be done on the page and also for all frames. (which is > > >> going to call your overridden function) > > > >> require 'watir' > > >> ie = Watir::IE.new > > >> ie.goto("http://www.w3schools.com/JS/tryit.asp? > > >> filename=tryjs_confirm") > > >> ie.maximize > > >> # override the frames window.confirm > > >> ie.frame(:name, "view").document.parentWindow.execScript > > >> ("window.confirm=function(){return true;}") > > >> ie.frame(:name, "view").button(:value, "Display a confirm > > >> box").click_no_wait > > > >> Wow .. great way to get rid of these confirm boxes.. only have to get > > >> this to work on firewatir tooo... > > >> Anyways I have tried this on IE8 RC1 - 8.0.6001.18344 > > > >> - Tony- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---