[wtr-general] Re: Clicking OK with Ajax jQuery pop up

2009-04-17 Thread Paul Rogers
are you sure the jquery pop up is really a pop up and not just a div on the
page? Poke at it with firebug or ie developer toolbar, and Im sure you'll
find its just a div

Paul

On Fri, Apr 17, 2009 at 10:28 AM, Yahoo tom.feodor...@conchango.com wrote:


 I know, yet another issue with pop ups regarding watir. Let me start
 by saying I've been using watir for the past 4 years and love it. That
 is, until our developers got cute and started using Ajax jQuery
 javascript to confirm if a user really wanted to delete something.

 We have a regular javascript pop up in our application which I was
 successfully able to handle thanks to the many posts in this forum,
 but for the life of me I can't get this Ajax pop up to work.

 To start, what I have working:

 The call I am using to produce the regular javascript pop up is:
 $ie.link(:text , Go).click!
 I then call the following method:
 def startClicker( browser, button , waitTime= 10)
  # get a handle if one exists
  puts in Start Clicker
  Timeout::timeout(2) do
hwnd = browser.enabled_popup(waitTime)
if (hwnd)  # yes there is a popup
  puts there is a pop up
  w = WinClicker.new
  # OK or whatever the name on the button is
  w.clickWindowsButton_hwnd( hwnd, #{button} )
  #
  # this is just cleanup
  w=nil
else
  puts there is no pop up
end
  end
 end

 Which is successful. Yay, a success story :) Now the fun.

 The following is what I call to produce the Ajax Confirm Deletion pop
 up:
 $ie.link(:title, Delete watir).click!

 I have tried startClicker($ie, OK) and get the following error:
 Timeout::Error: execution expired
c:/ruby/lib/ruby/1.8/timeout.rb:54:in `sleep'

 I have also tried autoit with the following:
 def autoitStartClicker()
  puts in autoitStartClicker
  autoit = WIN32OLE.new('AutoItX3.Control')
  autoit.WinWait('Confirm Deletion', '', 5)
  autoit.ControlClick(Confirm Deletion, , [CLASS:Button;
 TEXT:OK])
  autoit.Send('{OK}')
 end

 and got no errors and no results either. When doing these steps in
 IRB, I get:
 irb(main):011:0 ie.link(:title, Delete watir).click!
 = 
 irb(main):012:0 autoit = WIN32OLE.new('AutoItX3.Control')
 = #WIN32OLE:0x45d05f8
 irb(main):013:0 autoit.WinWait('Confirm Deletion', '', 5)
 = 0
 irb(main):014:0 autoit.ControlClick(Confirm Deletion, ,
 [CLASS:Button; TEXT:OK])
 = 0
 irb(main):015:0
 so it is able to create the win32ole autoit object, but it can't seem
 to find my Confirm Deletion pop up, hence =0. Which is even more
 evident from:
 irb(main):015:0 autoit.WinActivate('Confirm Deletion')
 = nil

 I also tried to attach to the pop up as if it were another window:
 irb(main):016:0 pop_up = Watir::IE.attach(:title, 'Confirm Deletion')
 Watir::Exception::NoMatchingWindowFoundException: Unable to locate a
 window with
  title of Confirm Deletion

 Then I tried the following (which mentions it is suppose to start some
 Ajax stuff):
 irb(main):018:0* ie.link(:url, %r|ConfirmDeletion|).click
 Watir::Exception::UnknownObjectException: Unable to locate element,
 using :url,
 /ConfirmDeletion/


 The javascript code used to delete the entity is:

 $(document).ready(function() {

$('.ajaxDeleteButton')
.click(function(i){
deleteButton($(this))
return false;
})
 });


 function deleteButton(button) {
jConfirm('Do you really want to delete?', 'Confirm Deletion',
 function
 (r) {
if (r == true) {
button.find(img).hide().attr(src, images/
 processing.gif).fadeIn(slow, function() {
doDelete(button);
});
}
});
 }

 function doDelete(button) {
jQuery.ajax({
type: POST,
url: button.attr(href),
success: function(msg) {
var row = button.parent().parent();
if (msg == 1) {
row.remove();
$(.stripey tr).removeClass(odd);
$(.stripey tr:odd).addClass(odd);

if(button.hasClass(reloadAfterDelete)) {
window.location.reload(true);
}
} else {

  row.find(td:first).addClass(errorTxt).prepend(This item is in
 use and cannot be deleted.br /);
button.remove();
}
}
});
 }

 I have discussed this issue with my developers and we are all hoping
 we can find a way for watir to handle this so they don't have to
 modify their code. We are just now at the stage where we are getting
 our watir scripts to run with cruise control for nightly tests, but
 without being able to click OK on this Confirm Deletion pop up, some
 assert tests are failing.

 I hope I've offered enough information here to get some discussion,
 but if you have any questions on specifics, 

[wtr-general] Re: Clicking OK with Ajax jQuery pop up

2009-04-17 Thread Yahoo

The code on the page to create the pop up is:

a class=ajaxDeleteButton href=deletesupplychainasm.dhtml?id=81
title=Delete watir

so I don't believe it would be in a div. There is no OK text
anywhere in the viewsource of the page or any Confirm Deletion text.
If it was just a div on the page, wouldn't I just be able to hit it
with regular watir code such as:

def clickOK()
  tries = 0
  until $ie.link(:text, OK).exists? do
sleep 0.5
tries += 1
  end
  $ie.link(:text, OK).click
end

This btw put me in an infinite loop as the text OK never existed.

I would add an image of what this pop up looked like, but I can't seem
to see where to upload images.


On Apr 17, 1:53 pm, Paul Rogers paul.rog...@shaw.ca wrote:
 are you sure the jquery pop up is really a pop up and not just a div on the
 page? Poke at it with firebug or ie developer toolbar, and Im sure you'll
 find its just a div

 Paul



 On Fri, Apr 17, 2009 at 10:28 AM, Yahoo tom.feodor...@conchango.com wrote:

  I know, yet another issue with pop ups regarding watir. Let me start
  by saying I've been using watir for the past 4 years and love it. That
  is, until our developers got cute and started using Ajax jQuery
  javascript to confirm if a user really wanted to delete something.

  We have a regular javascript pop up in our application which I was
  successfully able to handle thanks to the many posts in this forum,
  but for the life of me I can't get this Ajax pop up to work.

  To start, what I have working:

  The call I am using to produce the regular javascript pop up is:
  $ie.link(:text , Go).click!
  I then call the following method:
  def startClicker( browser, button , waitTime= 10)
   # get a handle if one exists
   puts in Start Clicker
   Timeout::timeout(2) do
     hwnd = browser.enabled_popup(waitTime)
     if (hwnd)  # yes there is a popup
       puts there is a pop up
       w = WinClicker.new
       # OK or whatever the name on the button is
       w.clickWindowsButton_hwnd( hwnd, #{button} )
       #
       # this is just cleanup
       w=nil
     else
       puts there is no pop up
     end
   end
  end

  Which is successful. Yay, a success story :) Now the fun.

  The following is what I call to produce the Ajax Confirm Deletion pop
  up:
  $ie.link(:title, Delete watir).click!

  I have tried startClicker($ie, OK) and get the following error:
  Timeout::Error: execution expired
     c:/ruby/lib/ruby/1.8/timeout.rb:54:in `sleep'

  I have also tried autoit with the following:
  def autoitStartClicker()
   puts in autoitStartClicker
   autoit = WIN32OLE.new('AutoItX3.Control')
   autoit.WinWait('Confirm Deletion', '', 5)
   autoit.ControlClick(Confirm Deletion, , [CLASS:Button;
  TEXT:OK])
   autoit.Send('{OK}')
  end

  and got no errors and no results either. When doing these steps in
  IRB, I get:
  irb(main):011:0 ie.link(:title, Delete watir).click!
  = 
  irb(main):012:0 autoit = WIN32OLE.new('AutoItX3.Control')
  = #WIN32OLE:0x45d05f8
  irb(main):013:0 autoit.WinWait('Confirm Deletion', '', 5)
  = 0
  irb(main):014:0 autoit.ControlClick(Confirm Deletion, ,
  [CLASS:Button; TEXT:OK])
  = 0
  irb(main):015:0
  so it is able to create the win32ole autoit object, but it can't seem
  to find my Confirm Deletion pop up, hence =0. Which is even more
  evident from:
  irb(main):015:0 autoit.WinActivate('Confirm Deletion')
  = nil

  I also tried to attach to the pop up as if it were another window:
  irb(main):016:0 pop_up = Watir::IE.attach(:title, 'Confirm Deletion')
  Watir::Exception::NoMatchingWindowFoundException: Unable to locate a
  window with
   title of Confirm Deletion

  Then I tried the following (which mentions it is suppose to start some
  Ajax stuff):
  irb(main):018:0* ie.link(:url, %r|ConfirmDeletion|).click
  Watir::Exception::UnknownObjectException: Unable to locate element,
  using :url,
  /ConfirmDeletion/

  The javascript code used to delete the entity is:

  $(document).ready(function() {

         $('.ajaxDeleteButton')
         .click(function(i){
                 deleteButton($(this))
                 return false;
         })
  });

  function deleteButton(button) {
         jConfirm('Do you really want to delete?', 'Confirm Deletion',
  function
  (r) {
             if (r == true) {
                 button.find(img).hide().attr(src, images/
  processing.gif).fadeIn(slow, function() {
                         doDelete(button);
                 });
             }
         });
  }

  function doDelete(button) {
         jQuery.ajax({
                 type: POST,
                 url: button.attr(href),
                 success: function(msg) {
                         var row = button.parent().parent();
                         if (msg == 1) {
                                 row.remove();
                                 $(.stripey tr).removeClass(odd);
                                 $(.stripey tr:odd).addClass(odd);

                                 if(button.hasClass(reloadAfterDelete)) 

[wtr-general] Re: Clicking OK with Ajax jQuery pop up

2009-04-17 Thread Paul Rogers
you wont see it with view source. Firebug ( in firefox) is the best way to
find it. Im guessing this link
http://mattberseth.com/blog/2008/09/dynamic_data_customizing_the_d.html

has what you are using

Paul

On Fri, Apr 17, 2009 at 2:48 PM, Yahoo tom.feodor...@conchango.com wrote:


 The code on the page to create the pop up is:

 a class=ajaxDeleteButton href=deletesupplychainasm.dhtml?id=81
 title=Delete watir

 so I don't believe it would be in a div. There is no OK text
 anywhere in the viewsource of the page or any Confirm Deletion text.
 If it was just a div on the page, wouldn't I just be able to hit it
 with regular watir code such as:

 def clickOK()
  tries = 0
  until $ie.link(:text, OK).exists? do
sleep 0.5
tries += 1
  end
  $ie.link(:text, OK).click
 end

 This btw put me in an infinite loop as the text OK never existed.

 I would add an image of what this pop up looked like, but I can't seem
 to see where to upload images.


 On Apr 17, 1:53 pm, Paul Rogers paul.rog...@shaw.ca wrote:
  are you sure the jquery pop up is really a pop up and not just a div on
 the
  page? Poke at it with firebug or ie developer toolbar, and Im sure you'll
  find its just a div
 
  Paul
 
 
 
  On Fri, Apr 17, 2009 at 10:28 AM, Yahoo tom.feodor...@conchango.com
 wrote:
 
   I know, yet another issue with pop ups regarding watir. Let me start
   by saying I've been using watir for the past 4 years and love it. That
   is, until our developers got cute and started using Ajax jQuery
   javascript to confirm if a user really wanted to delete something.
 
   We have a regular javascript pop up in our application which I was
   successfully able to handle thanks to the many posts in this forum,
   but for the life of me I can't get this Ajax pop up to work.
 
   To start, what I have working:
 
   The call I am using to produce the regular javascript pop up is:
   $ie.link(:text , Go).click!
   I then call the following method:
   def startClicker( browser, button , waitTime= 10)
# get a handle if one exists
puts in Start Clicker
Timeout::timeout(2) do
  hwnd = browser.enabled_popup(waitTime)
  if (hwnd)  # yes there is a popup
puts there is a pop up
w = WinClicker.new
# OK or whatever the name on the button is
w.clickWindowsButton_hwnd( hwnd, #{button} )
#
# this is just cleanup
w=nil
  else
puts there is no pop up
  end
end
   end
 
   Which is successful. Yay, a success story :) Now the fun.
 
   The following is what I call to produce the Ajax Confirm Deletion pop
   up:
   $ie.link(:title, Delete watir).click!
 
   I have tried startClicker($ie, OK) and get the following error:
   Timeout::Error: execution expired
  c:/ruby/lib/ruby/1.8/timeout.rb:54:in `sleep'
 
   I have also tried autoit with the following:
   def autoitStartClicker()
puts in autoitStartClicker
autoit = WIN32OLE.new('AutoItX3.Control')
autoit.WinWait('Confirm Deletion', '', 5)
autoit.ControlClick(Confirm Deletion, , [CLASS:Button;
   TEXT:OK])
autoit.Send('{OK}')
   end
 
   and got no errors and no results either. When doing these steps in
   IRB, I get:
   irb(main):011:0 ie.link(:title, Delete watir).click!
   = 
   irb(main):012:0 autoit = WIN32OLE.new('AutoItX3.Control')
   = #WIN32OLE:0x45d05f8
   irb(main):013:0 autoit.WinWait('Confirm Deletion', '', 5)
   = 0
   irb(main):014:0 autoit.ControlClick(Confirm Deletion, ,
   [CLASS:Button; TEXT:OK])
   = 0
   irb(main):015:0
   so it is able to create the win32ole autoit object, but it can't seem
   to find my Confirm Deletion pop up, hence =0. Which is even more
   evident from:
   irb(main):015:0 autoit.WinActivate('Confirm Deletion')
   = nil
 
   I also tried to attach to the pop up as if it were another window:
   irb(main):016:0 pop_up = Watir::IE.attach(:title, 'Confirm Deletion')
   Watir::Exception::NoMatchingWindowFoundException: Unable to locate a
   window with
title of Confirm Deletion
 
   Then I tried the following (which mentions it is suppose to start some
   Ajax stuff):
   irb(main):018:0* ie.link(:url, %r|ConfirmDeletion|).click
   Watir::Exception::UnknownObjectException: Unable to locate element,
   using :url,
   /ConfirmDeletion/
 
   The javascript code used to delete the entity is:
 
   $(document).ready(function() {
 
  $('.ajaxDeleteButton')
  .click(function(i){
  deleteButton($(this))
  return false;
  })
   });
 
   function deleteButton(button) {
  jConfirm('Do you really want to delete?', 'Confirm Deletion',
   function
   (r) {
  if (r == true) {
  button.find(img).hide().attr(src, images/
   processing.gif).fadeIn(slow, function() {
  doDelete(button);
  });
  }
  });
   }
 
   function doDelete(button) {
  jQuery.ajax({
  type: POST,
  

[wtr-general] Re: Clicking OK with Ajax jQuery pop up

2009-04-17 Thread Yahoo

Not quite what ours looks like, but I think you're on the right track.
I think our developers must have played with the css to make it a
little prettier. I'm not familiar with Firebug, so how could I get my
watir code to click this OK button?

On Apr 17, 2:53 pm, Paul Rogers paul.rog...@shaw.ca wrote:
 you wont see it with view source. Firebug ( in firefox) is the best way to
 find it. Im guessing this 
 linkhttp://mattberseth.com/blog/2008/09/dynamic_data_customizing_the_d.html

 has what you are using

 Paul



 On Fri, Apr 17, 2009 at 2:48 PM, Yahoo tom.feodor...@conchango.com wrote:

  The code on the page to create the pop up is:

  a class=ajaxDeleteButton href=deletesupplychainasm.dhtml?id=81
  title=Delete watir

  so I don't believe it would be in a div. There is no OK text
  anywhere in the viewsource of the page or any Confirm Deletion text.
  If it was just a div on the page, wouldn't I just be able to hit it
  with regular watir code such as:

  def clickOK()
   tries = 0
   until $ie.link(:text, OK).exists? do
     sleep 0.5
     tries += 1
   end
   $ie.link(:text, OK).click
  end

  This btw put me in an infinite loop as the text OK never existed.

  I would add an image of what this pop up looked like, but I can't seem
  to see where to upload images.

  On Apr 17, 1:53 pm, Paul Rogers paul.rog...@shaw.ca wrote:
   are you sure the jquery pop up is really a pop up and not just a div on
  the
   page? Poke at it with firebug or ie developer toolbar, and Im sure you'll
   find its just a div

   Paul

   On Fri, Apr 17, 2009 at 10:28 AM, Yahoo tom.feodor...@conchango.com
  wrote:

I know, yet another issue with pop ups regarding watir. Let me start
by saying I've been using watir for the past 4 years and love it. That
is, until our developers got cute and started using Ajax jQuery
javascript to confirm if a user really wanted to delete something.

We have a regular javascript pop up in our application which I was
successfully able to handle thanks to the many posts in this forum,
but for the life of me I can't get this Ajax pop up to work.

To start, what I have working:

The call I am using to produce the regular javascript pop up is:
$ie.link(:text , Go).click!
I then call the following method:
def startClicker( browser, button , waitTime= 10)
 # get a handle if one exists
 puts in Start Clicker
 Timeout::timeout(2) do
   hwnd = browser.enabled_popup(waitTime)
   if (hwnd)  # yes there is a popup
     puts there is a pop up
     w = WinClicker.new
     # OK or whatever the name on the button is
     w.clickWindowsButton_hwnd( hwnd, #{button} )
     #
     # this is just cleanup
     w=nil
   else
     puts there is no pop up
   end
 end
end

Which is successful. Yay, a success story :) Now the fun.

The following is what I call to produce the Ajax Confirm Deletion pop
up:
$ie.link(:title, Delete watir).click!

I have tried startClicker($ie, OK) and get the following error:
Timeout::Error: execution expired
   c:/ruby/lib/ruby/1.8/timeout.rb:54:in `sleep'

I have also tried autoit with the following:
def autoitStartClicker()
 puts in autoitStartClicker
 autoit = WIN32OLE.new('AutoItX3.Control')
 autoit.WinWait('Confirm Deletion', '', 5)
 autoit.ControlClick(Confirm Deletion, , [CLASS:Button;
TEXT:OK])
 autoit.Send('{OK}')
end

and got no errors and no results either. When doing these steps in
IRB, I get:
irb(main):011:0 ie.link(:title, Delete watir).click!
= 
irb(main):012:0 autoit = WIN32OLE.new('AutoItX3.Control')
= #WIN32OLE:0x45d05f8
irb(main):013:0 autoit.WinWait('Confirm Deletion', '', 5)
= 0
irb(main):014:0 autoit.ControlClick(Confirm Deletion, ,
[CLASS:Button; TEXT:OK])
= 0
irb(main):015:0
so it is able to create the win32ole autoit object, but it can't seem
to find my Confirm Deletion pop up, hence =0. Which is even more
evident from:
irb(main):015:0 autoit.WinActivate('Confirm Deletion')
= nil

I also tried to attach to the pop up as if it were another window:
irb(main):016:0 pop_up = Watir::IE.attach(:title, 'Confirm Deletion')
Watir::Exception::NoMatchingWindowFoundException: Unable to locate a
window with
 title of Confirm Deletion

Then I tried the following (which mentions it is suppose to start some
Ajax stuff):
irb(main):018:0* ie.link(:url, %r|ConfirmDeletion|).click
Watir::Exception::UnknownObjectException: Unable to locate element,
using :url,
/ConfirmDeletion/

The javascript code used to delete the entity is:

$(document).ready(function() {

       $('.ajaxDeleteButton')
       .click(function(i){
               deleteButton($(this))
               return false;
       })
});

function deleteButton(button) {
       jConfirm('Do you really 

[wtr-general] Re: Clicking OK with Ajax jQuery pop up

2009-04-17 Thread Paul Rogers
until you figure out what type of element it is, you wont be able to click
it ;-)

down load firefox
goto getfirebug.com
install firefbug
restart firefoc and goto the age where your OK is
in the bottom right of the firefox window is a little bug thing
click that
you will get a split window with firebug at the bottom
click Inspect
click the OK button
Firebug should display all the details about the OK

Paul


On Fri, Apr 17, 2009 at 3:03 PM, Yahoo tom.feodor...@conchango.com wrote:


 Not quite what ours looks like, but I think you're on the right track.
 I think our developers must have played with the css to make it a
 little prettier. I'm not familiar with Firebug, so how could I get my
 watir code to click this OK button?

 On Apr 17, 2:53 pm, Paul Rogers paul.rog...@shaw.ca wrote:
  you wont see it with view source. Firebug ( in firefox) is the best way
 to
  find it. Im guessing this linkhttp://
 mattberseth.com/blog/2008/09/dynamic_data_customizing_the_d.html
 
  has what you are using
 
  Paul
 
 
 
  On Fri, Apr 17, 2009 at 2:48 PM, Yahoo tom.feodor...@conchango.com
 wrote:
 
   The code on the page to create the pop up is:
 
   a class=ajaxDeleteButton href=deletesupplychainasm.dhtml?id=81
   title=Delete watir
 
   so I don't believe it would be in a div. There is no OK text
   anywhere in the viewsource of the page or any Confirm Deletion text.
   If it was just a div on the page, wouldn't I just be able to hit it
   with regular watir code such as:
 
   def clickOK()
tries = 0
until $ie.link(:text, OK).exists? do
  sleep 0.5
  tries += 1
end
$ie.link(:text, OK).click
   end
 
   This btw put me in an infinite loop as the text OK never existed.
 
   I would add an image of what this pop up looked like, but I can't seem
   to see where to upload images.
 
   On Apr 17, 1:53 pm, Paul Rogers paul.rog...@shaw.ca wrote:
are you sure the jquery pop up is really a pop up and not just a div
 on
   the
page? Poke at it with firebug or ie developer toolbar, and Im sure
 you'll
find its just a div
 
Paul
 
On Fri, Apr 17, 2009 at 10:28 AM, Yahoo tom.feodor...@conchango.com
 
   wrote:
 
 I know, yet another issue with pop ups regarding watir. Let me
 start
 by saying I've been using watir for the past 4 years and love it.
 That
 is, until our developers got cute and started using Ajax jQuery
 javascript to confirm if a user really wanted to delete something.
 
 We have a regular javascript pop up in our application which I was
 successfully able to handle thanks to the many posts in this forum,
 but for the life of me I can't get this Ajax pop up to work.
 
 To start, what I have working:
 
 The call I am using to produce the regular javascript pop up is:
 $ie.link(:text , Go).click!
 I then call the following method:
 def startClicker( browser, button , waitTime= 10)
  # get a handle if one exists
  puts in Start Clicker
  Timeout::timeout(2) do
hwnd = browser.enabled_popup(waitTime)
if (hwnd)  # yes there is a popup
  puts there is a pop up
  w = WinClicker.new
  # OK or whatever the name on the button is
  w.clickWindowsButton_hwnd( hwnd, #{button} )
  #
  # this is just cleanup
  w=nil
else
  puts there is no pop up
end
  end
 end
 
 Which is successful. Yay, a success story :) Now the fun.
 
 The following is what I call to produce the Ajax Confirm Deletion
 pop
 up:
 $ie.link(:title, Delete watir).click!
 
 I have tried startClicker($ie, OK) and get the following error:
 Timeout::Error: execution expired
c:/ruby/lib/ruby/1.8/timeout.rb:54:in `sleep'
 
 I have also tried autoit with the following:
 def autoitStartClicker()
  puts in autoitStartClicker
  autoit = WIN32OLE.new('AutoItX3.Control')
  autoit.WinWait('Confirm Deletion', '', 5)
  autoit.ControlClick(Confirm Deletion, , [CLASS:Button;
 TEXT:OK])
  autoit.Send('{OK}')
 end
 
 and got no errors and no results either. When doing these steps in
 IRB, I get:
 irb(main):011:0 ie.link(:title, Delete watir).click!
 = 
 irb(main):012:0 autoit = WIN32OLE.new('AutoItX3.Control')
 = #WIN32OLE:0x45d05f8
 irb(main):013:0 autoit.WinWait('Confirm Deletion', '', 5)
 = 0
 irb(main):014:0 autoit.ControlClick(Confirm Deletion, ,
 [CLASS:Button; TEXT:OK])
 = 0
 irb(main):015:0
 so it is able to create the win32ole autoit object, but it can't
 seem
 to find my Confirm Deletion pop up, hence =0. Which is even more
 evident from:
 irb(main):015:0 autoit.WinActivate('Confirm Deletion')
 = nil
 
 I also tried to attach to the pop up as if it were another window:
 irb(main):016:0 pop_up = Watir::IE.attach(:title, 'Confirm
 Deletion')
 Watir::Exception::NoMatchingWindowFoundException: Unable to locate
 a
 window 

[wtr-general] Re: Clicking OK with Ajax jQuery pop up

2009-04-17 Thread Yahoo

Cool, Yes, it appears it is in a div:

body onload=breakout_of_frame(); JumpToError();
  div id=container
  /div
  div id=popup_overlay style=background: rgb(255, 255, 255) none
repeat scroll 0%; position: absolute; z-index: 8; top: 0px; left:
0px; width: 100%; height: 600px; -moz-background-clip: -moz-initial; -
moz-background-origin: -moz-initial; -moz-background-inline-policy: -
moz-initial; opacity: 0.01;/
div id=popup_container class=ui-draggable style=margin: 0pt;
padding: 0pt; position: fixed; z-index: 9; min-width: 304px; max-
width: 304px; top: 32px; left: 331px;
  h1 id=popup_title style=cursor: move;Confirm Deletion/h1
  div id=popup_content class=confirm
div id=popup_messageDo you really want to delete?/div
  div id=popup_panel
input id=popup_ok type=button value= OK /
input id=popup_cancel type=button value= Cancel /
  /div
/div
 /div


So now the following code:

$ie.button(:id, popup_ok).click

Worked!! Woohoo. Thanks Paul


On Apr 17, 3:12 pm, Paul Rogers paul.rog...@shaw.ca wrote:
 until you figure out what type of element it is, you wont be able to click
 it ;-)

 down load firefox
 goto getfirebug.com
 install firefbug
 restart firefoc and goto the age where your OK is
 in the bottom right of the firefox window is a little bug thing
 click that
 you will get a split window with firebug at the bottom
 click Inspect
 click the OK button
 Firebug should display all the details about the OK

 Paul



 On Fri, Apr 17, 2009 at 3:03 PM, Yahoo tom.feodor...@conchango.com wrote:

  Not quite what ours looks like, but I think you're on the right track.
  I think our developers must have played with the css to make it a
  little prettier. I'm not familiar with Firebug, so how could I get my
  watir code to click this OK button?

  On Apr 17, 2:53 pm, Paul Rogers paul.rog...@shaw.ca wrote:
   you wont see it with view source. Firebug ( in firefox) is the best way
  to
   find it. Im guessing this linkhttp://
  mattberseth.com/blog/2008/09/dynamic_data_customizing_the_d.html

   has what you are using

   Paul

   On Fri, Apr 17, 2009 at 2:48 PM, Yahoo tom.feodor...@conchango.com
  wrote:

The code on the page to create the pop up is:

a class=ajaxDeleteButton href=deletesupplychainasm.dhtml?id=81
title=Delete watir

so I don't believe it would be in a div. There is no OK text
anywhere in the viewsource of the page or any Confirm Deletion text.
If it was just a div on the page, wouldn't I just be able to hit it
with regular watir code such as:

def clickOK()
 tries = 0
 until $ie.link(:text, OK).exists? do
   sleep 0.5
   tries += 1
 end
 $ie.link(:text, OK).click
end

This btw put me in an infinite loop as the text OK never existed.

I would add an image of what this pop up looked like, but I can't seem
to see where to upload images.

On Apr 17, 1:53 pm, Paul Rogers paul.rog...@shaw.ca wrote:
 are you sure the jquery pop up is really a pop up and not just a div
  on
the
 page? Poke at it with firebug or ie developer toolbar, and Im sure
  you'll
 find its just a div

 Paul

 On Fri, Apr 17, 2009 at 10:28 AM, Yahoo tom.feodor...@conchango.com

wrote:

  I know, yet another issue with pop ups regarding watir. Let me
  start
  by saying I've been using watir for the past 4 years and love it.
  That
  is, until our developers got cute and started using Ajax jQuery
  javascript to confirm if a user really wanted to delete something.

  We have a regular javascript pop up in our application which I was
  successfully able to handle thanks to the many posts in this forum,
  but for the life of me I can't get this Ajax pop up to work.

  To start, what I have working:

  The call I am using to produce the regular javascript pop up is:
  $ie.link(:text , Go).click!
  I then call the following method:
  def startClicker( browser, button , waitTime= 10)
   # get a handle if one exists
   puts in Start Clicker
   Timeout::timeout(2) do
     hwnd = browser.enabled_popup(waitTime)
     if (hwnd)  # yes there is a popup
       puts there is a pop up
       w = WinClicker.new
       # OK or whatever the name on the button is
       w.clickWindowsButton_hwnd( hwnd, #{button} )
       #
       # this is just cleanup
       w=nil
     else
       puts there is no pop up
     end
   end
  end

  Which is successful. Yay, a success story :) Now the fun.

  The following is what I call to produce the Ajax Confirm Deletion
  pop
  up:
  $ie.link(:title, Delete watir).click!

  I have tried startClicker($ie, OK) and get the following error:
  Timeout::Error: execution expired
     c:/ruby/lib/ruby/1.8/timeout.rb:54:in `sleep'

  I have also tried autoit with the following:
  def 

[wtr-general] Re: Clicking OK with Ajax jQuery pop up

2009-04-17 Thread Chuck van der Linden

On Apr 17, 3:02 pm, Yahoo tom.feodor...@conchango.com wrote:
 Cool, Yes, it appears it is in a div:

 body onload=breakout_of_frame(); JumpToError();
   div id=container
   /div
   div id=popup_overlay style=background: rgb(255, 255, 255) none
 repeat scroll 0%; position: absolute; z-index: 8; top: 0px; left:
 0px; width: 100%; height: 600px; -moz-background-clip: -moz-initial; -
 moz-background-origin: -moz-initial; -moz-background-inline-policy: -
 moz-initial; opacity: 0.01;/
     div id=popup_container class=ui-draggable style=margin: 0pt;
 padding: 0pt; position: fixed; z-index: 9; min-width: 304px; max-
 width: 304px; top: 32px; left: 331px;
       h1 id=popup_title style=cursor: move;Confirm Deletion/h1
       div id=popup_content class=confirm
         div id=popup_messageDo you really want to delete?/div
           div id=popup_panel
             input id=popup_ok type=button value= OK /
             input id=popup_cancel type=button value= Cancel /
           /div
         /div
      /div

 So now the following code:

 $ie.button(:id, popup_ok).click

 Worked!! Woohoo. Thanks Paul


Great news! thanks for letting us know what worked for you.

with any luck these new-style 'popups' will actually be easier to
handle

By the way, when you check to see 'if' this popup exists, you might
find you need know a bit more about how it actually works.. Ask them
if it's being created on the fly, or if it is really there all the
time but hidden by being off-screen, or set with visibility off,
etc.   You might find you need to be checking on some attribute or
property of the div to figure out if it's 'there' or 'not there' from
the user's perspective.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---