You could try:

xpath="count(//[EMAIL 
PROTECTED]'form1:table1:_tableActionsBottom:_paginationNextButton'])>0"

Cheers, Paul.

Chang Su wrote:
Hi,
The xml is as follows,

...
<storeXPath
description="Extract href of next button"
xpath="//[EMAIL 
PROTECTED]'form1:table1:_tableActionsBottom:_paginationNextButton']"
property="uri" />

<ifStep test="#{uri}" >
<clickElement
xpath="//[EMAIL 
PROTECTED]'form1:table1:_tableActionsBottom:_paginationNextButton']"
/>
<verifytitle
      text="All Domains"/>
.....
</ifStep>


If I use test="#{uri}", I got exception as below, and
if I use "${uri}" the test fails even though the
button exists in the page.
Seems test parameter in <ifStep> only recognize "true"
or "false" but nothing else. How do I translate the
property of xpath into a boolean "true" or "false"?

(my original question is:

if next_page_button exists:
    click the button;
else
    do something else;
)

thanks,

Chang


--- John and Pip <[EMAIL PROTECTED]> wrote:

Hi Mary,

It looks like a syntax error in  the ifStep in that
it is not recognising
the test attribute of the ifStep element. Could you
post the actual xml you
are using? This is a very common constuct that I
haven't had any problems
with.

regards,
        John

On 3/1/07, Paul King <[EMAIL PROTECTED]> wrote:

I've been flat out this week. If you are still
having troubles
I will try to look at this again on the weekend.

Cheers, Paul.

Chang Su wrote:
Hi, Dierk,

thanks for your reply. If I change to use
"#{uri}" I
am getting following exception,

Exception raised:
com.canoo.webtest.engine.StepExecutionException:
One
of the 'test' or the 'unless' attributes or
nested
tags is required., Step: IfStep at

/home/testsuites/src/AllDomains/SimpleHTTPS.xml:105:
with

(taskName="ifStep")com.canoo.webtest.engine.StepExecutionException:
One of the 'test' or the 'unless' attributes or
nested
tags is required., Step: IfStep at

/home/testsuites/src/AllDomains/SimpleHTTPS.xml:105:
with (taskName="ifStep")
        at

com.canoo.webtest.steps.Step.paramCheck(Step.java:423)
        at

com.canoo.webtest.steps.control.IfStep.verifyParameters(IfStep.java:117)
        at

com.canoo.webtest.steps.Step.execute(Step.java:105)
        at

org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at
org.apache.tools.ant.Task.perform(Task.java:364)

......



Mary

--- Dierk Koenig <[EMAIL PROTECTED]> wrote:

change
 <ifStep test="${uri}" >
to
 <ifStep test="#{uri}" >

(alternatively, set the propertytype to 'ant')

Dierk

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Behalf Of
Chang Su
Sent: Sonntag, 25. Februar 2007 8:15
To: [email protected]; Paul King
Subject: Re: [Webtest] how to implement "if"
logic

Thanks Paul, I tried following but could not
get
it to
work,

<storeXPath
description="Extract href of next button"

xpath="//[EMAIL 
PROTECTED]'form1:table1:_tableActionsBottom:_paginationNextButton']"
property="uri" />

<ifStep test="${uri}" >
<clickElement

xpath="//[EMAIL 
PROTECTED]'form1:table1:_tableActionsBottom:_paginationNextButton']"
/>
 <verifytitle
     text="All Domains"/>
.....

</ifStep>


it could not pass the test though the button
is
present. Do you spot any problem with above
code?

thanks,

Mary

--- Paul King <[EMAIL PROTECTED]> wrote:

Maybe ifStep is what you are after:


http://webtest.canoo.com/webtest/manual/ifStep.html
Store an xpath that would be true based on
the
next
link
and use that as the test parameter.

Paul.

Chang Su wrote:
Hi,

I have a BUI page which mainly includes a
table.
If
the rows in the table are more than 10, then
there
is
a "Next" button shown on the page and
clicking
on
it
goes to next page of the table.

So I need to implement something like,

1. use <scriptStep> to obtain table contents
on
page 1
2. If there is a "Next" button on the page,
click
the
button to go to next page

3. use <scriptStep> to obtain table contents
on
page 2
I know how to do 1) and 3), however I don't
know
how
to implement the if logic using webtest.
Anyone
has
idea how to implement this?


thanks,

Chang

_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest




____________________________________________________________________________________ Finding fabulous fares is fun. Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.
http://farechase.yahoo.com/promo-generic-14795097
_______________________________________________
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