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
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
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,
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
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
Hi Jagdeep,
I am still unable to override the confirm function. The result should
tell me that 'You pressed OK!'.
It seems that execScript is running as a DOS window flashes, however I
am just left with the dialog.
Do I need to change some js settings in IE.
Aidy
2009/1/5 Jagdeep Jain
Hi Aidy,
I have changed disp_confirm with the earlier one you have supplied
window.confirm and removed JavaScript from the end and it works
fine for me.
require 'watir'
ie = Watir::IE.new
ie.goto(http://www.w3schools.com/JS/tryit.asp?
filename=tryjs_confirm)
ie.maximize
Execscript exists on the window object, drop the body call from your code
and it should work:
http://msdn.microsoft.com/en-us/library/ms536420(VS.85).aspx
Charley Baker
blog: http://charleybakersblog.blogspot.com/
Project Manager, Watir, http://wtr.rubyforge.org
QA Architect, Gap Inc Direct
On