Since I'm not a programmer, or apparently not even a very smart
tester, it didn't occur to me even to look for a unit test, sorry! 
;->

However, I did study your example and make an attempt.  It is still
not working and I hope maybe someone can help if I post more
information.  I've had two smart coworkers who know some ruby try to
get this working, with no success.  (I don't want anyone to think we
aren't trying!)

Here is what I think is the relevant source code we have for the dialog button:
id="deleteLink1"  onclick="javascript: if (window.confirm('Are you
sure you want to delete \'Dakota Group4259\'?'))

Here is what I am trying, please see the comments within this:
    ie.link(:id, "deleteLink1").click
    # When we uncomment this block of code and comment out the
previous line, we don't get the dialog popup at all
    # ie.remote_eval <<-END
    # The ie.link is what we really do to get the dialog window to come up
    #   ie.link(:id, "deleteLink1").click
      #  Bret's example has this, but we don't hvae a button named
confirm so we commented it out:   button(:value, 'confirm').click
      #   END
      # This assert always fails if we have the previous block uncommented
      # assert dialog.exists?
     dialog.button('OK').click

(the last line is the line that gets the error)

Here is the error I get.
  1) Error:
test_manage_groups(TC_ManageGroups):
Watir::Exception::UnknownObjectException:
    c:/ruby/lib/ruby/site_ruby/1.8/watir/dialog.rb:34:in `click'
    C:/java/eplan70/src/watir/scripts/simple/Payroll/tc_manage_groups.rb:97:in
test_manage_groups'

Can anyone offer any pointers, or a bit of working code that clicks a
javascript alert button on some public site that I can use as an
example?

Thanks very much.  We are getting some traction with Watir, but we
have lots of these alert buttons (which is one of the reasons we are
trying Watir; our Canoo WebTest scripts also cannot click the
javascript alerts), and we will be severely limited if we can't click
them.
-- Lisa

> Message: 2
> Date: Wed, 24 Aug 2005 23:26:17 -0500
> From: Bret Pettichord <[EMAIL PROTECTED]>
> Subject: Re: [Wtr-general] Re: How to click a javascript alert button
> To: [email protected]
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="us-ascii"; format=flowed
> 
> When confused, check the unit test.
> 
>  From dialog_test.rb:
> 
>      def test_confirm_ok
>          $ie.remote_eval <<-END
>              button(:value, 'confirm').click
>          END
>          assert dialog.exists?
>          dialog.button('OK').click
>          assert_equal "You pressed the Confirm and OK button!",
> $ie.text_field(:id, 'testResult').value
>      end
> 
> 
> At 02:06 PM 8/24/2005, Lisa Crispin wrote:
> >I did look at dialog.rb, but my ruby/watir/general programming
> >language knowledge is not sufficient to understand how to write the
> >script to click a javascript alert button. Can anyone provide a more
> >detailed explanation?  Is there any doc on 'autoit' that might help
> >me?
> >thanks
> >Lisa
> >

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to