Hello all,
I am having a application in which user can be created,updated and deleted.
On delete action popup is there which onclick it shows a pop up box along
with two buttons i.e. Ok and Cancel

My scenario is:
User should be able to click on "Destroy" link and then click on "OK" in the
pop up box

But after inspecting the "Destroy" link following code is getting displayed
<a onclick="if (confirm('Are you sure?')) { var f =
document.createElement('form'); f.style.display = 'none';
this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var
m = document.createElement('input'); m.setAttribute('type', 'hidden');
m.setAttribute('name', '_method'); m.setAttribute('value', 'delete');
f.appendChild(m);var s = document.createElement('input');
s.setAttribute('type', 'hidden'); s.setAttribute('name',
'authenticity_token'); s.setAttribute('value',
'TUrgfZQeTtveBgV82E0NTafS1xf4f6g3scwZxeFvX5o=');
f.appendChild(s);f.submit(); };return false;" href="/users/5">Destroy</a>

Following is the code i am trying but not getting success:

require 'rubygems'
require 'firewatir'
Watir::Browser.default = 'firefox'
Browser = Watir::Browser.new
Browser.goto("http://localhost:3000/users";)
Browser.link(":href","/users/5").click --  *This step should click the
"Destroy" link but it is not.*
Browser.execute_script("window.confirm = function() {return true}")
#Browser.execute_script "window.confirm = function() { return true; }"
Browser.button(:value => 'OK').click

Does anybody knows how to overcome this problem?

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to