Try this ... I am not sure if it would work definitively ... or if you are interested in changing your script at all. But here is my suggestion:

 

Your JSP will be something like this:

      ...

Function clickOK()

      {

            if (confirm('Are you sure you want to delete \'Monthly Employees\'?'))

            {

                  ...

                  location=”/plan/manageEmployeeGroups.vm?mode=delete&groupId=16606”;

                  ...

            }

      }

      Function clickCancel()

      {

            ...

      }

      ...

      <TD>

            <INPUT TYPE="BUTTON" VALUE="OK" >

      </TD>

       

      <TD>

      <INPUT TYPE="BUTTON" VALUE="Cancel" >

      </TD>

      ...

 

And your webtest steps will be:

        <expectDialog description="expect a popup window"

            dialogType="confirm" response="OK" />

         

         <clickbutton

             description=" click the ok button "

             label="OK"/>

 

I am not sure how webtest would identify your OK button from your source code. Maybe some one does.

 

Hope it helps,

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lisa Crispin
Sent: Friday, September 15, 2006 12:36 PM
To: [email protected]
Subject: RE: [Webtest] _javascript_ popups

 

I did try this, but I got an error:

com.canoo.webtest.engine.StepFailedException: No button found, Step: ClickButton at C:\java\eplan70\src\web_test\SmokeTest\TestContributionGroups.xml:100: with (description=" click the ok button ", label="OK", taskName="clickbutton")

Location:

 

My script has:

        <expectDialog description="expect a popup window"

            dialogType="confirm" response="OK" />

         

         <clickbutton

             description=" click the ok button "

             label="OK"/>

 

Is it possible the _javascript_ popup is defective in some way?  The source code for it is in my original email.

Thank you,

Lisa

 

 -------------- Original message ----------------------

From: "Aarathi Niranjan" <[EMAIL PROTECTED]>

> Yes, you should use 'clickButton'. But it will work only if you specify

> expectDialog before the clickbutton.

>

> Example:

>       <expectDialog

>                 description="Expect a pop-up window"

>                 dialogType="confirm" response="true" />

>

>         <clickbutton

>                 description=" click the ok button "

>                 label="OK"/> <!-- Replace with your button name -->

>

> Thanks,

>

> -----Original Message-----

> From: [EMAIL PROTECTED]

> [mailto:[EMAIL PROTECTED] On Behalf Of Lisa Crispin

> Sent: Friday, September 15, 2006 12:19 PM

> To: [email protected]

> Subject: RE: [Webtest] _javascript_ popups

>

> Thanks.  ExpectDialog seems like just the ticket but it doesn't seem to

> click the button for me.  The examples on the page are confusing me

> because they are for complex scenarios. Does anyone have a simple

> example of how to click the 'ok' button on a confirm window (eg. "Do you

> really want to delete" with OK and Cancel buttons).

>

> I tried this:

>         <expectDialog description="click the ok button"

>             dialogType="confirm" response="true" />

>

> I don't get any errors, but neither does it click the button.  Do I have

> to use clickButton?  It didn't seem to me I should from the

> documentation, but I tried it anyway, WebTest predictably couldn't find

> the button.

> thanks

> Lisa

>

>  -------------- Original message ----------------------

> From: "Aarathi Niranjan" <[EMAIL PROTECTED]>

> > You can do it with <expectDialog>

> >

> > http://webtest.canoo.com/webtest/manual/expectDialog.html

> > http://webtest.canoo.com/webtest/manual/expectDialogs.html

> >

> > Hope that helps,

> >

> > -----Original Message-----

> > From: [EMAIL PROTECTED]

> > [mailto:[EMAIL PROTECTED] On Behalf Of Lisa Crispin

> > Sent: Friday, September 15, 2006 11:19 AM

> > To: [email protected]

> > Subject: [Webtest] _javascript_ popups

> >

> > A couple years ago we struggled with trying to handle _javascript_ popup

> > windows with WebTest and never figured out how to do it.

> >

> > I've been searching the archive to see if there has been improvement

> > since version 2 but I can't quite tell.

> >

> > If I have a _javascript_ window such as this, how can I click the ok

> > button with WebTest?  Our current workaround is either to just go

> > directly to the url, or write the script in Watir where we know how to

> > click this button.

> > if (window.confirm('Are you sure you want to

> delete

> > \'Monthly Employees\'?'))

> >

> location.href='';

> > ""

> >

> > Thanks,

> > Lisa

> > _______________________________________________

> > WebTest mailing list

> > [email protected]

> > http://lists.canoo.com/mailman/listinfo/webtest

> > _______________________________________________

> > WebTest mailing list

> > [email protected]

> > http://lists.canoo.com/mailman/listinfo/webtest

>

>

> _______________________________________________

> WebTest mailing list

> [email protected]

> http://lists.canoo.com/mailman/listinfo/webtest

> _______________________________________________

> WebTest mailing list

> [email protected]

> http://lists.canoo.com/mailman/listinfo/webtest

 

 

_______________________________________________

WebTest mailing list

[email protected]

http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to