[Webtest] Does a verifytext with a table locator trim out whitespace?
Eric Pugh
webtest@lists.canoo.com
Mon, 13 May 2002 12:05:46 -0400
Hi all,
I have a step that continually fails:
<verifytext stepid="Check for reaction in appropriate plate plan"
text="1" >
<table row="1" column="2" id="tablePlatePlan"/>
</verifytext>
And the first couple lines of my HTML look like this:
<table width="100%" cellspacing="2" cellpadding="4" border="1"
align="center" id="tablePlatePlan">
<tr class="table_head" >
<td></td>
<th>1</th>
<th>2</th>
<th>3</th>
<th>4</th>
<th>5</th>
<th>6</th>
<th>7</th>
<th>8</th>
<th>9</th>
<th>10</th>
<th>11</th>
<th>12</th>
<TR class=" table_row_alt ">
<th class="table_head"> 1</th>
<TD align="center">
5
</TD>
<TD align="center">
1
</TD>
<TD align="center">
3
</TD>
<TD align="center">
</TD>
Does all the white space in the TD cause this to not work? I was trying to
get it to work with VerifyText or verify Element, but no luck..
Eric
-----Original Message-----
From: webtest-admin@gate.canoo.com
[mailto:webtest-admin@gate.canoo.com]On Behalf Of Dierk König
Sent: Friday, May 10, 2002 10:59 AM
To: webtest@gate.canoo.com
Subject: RE: [Webtest] FW: help
Here some examples:
> <a href="javascript:go_to_login();" name="toLogin">
> > <img src="../images/bf_logo.gif" border="0" alt="Zum
> > Login"/>
> > </a>
could be checked by regex with (all the perl hackers: please forgive me):
<verifytext regex="true" text="\s\Wa href=.javascript:go_to_login.*?Zum
Login.*?\/a\W\s" />
the elements of the regex are:
\s one whitespace character
\W a non-word character
a href= exactly this text part
. any character
javascript:go_to_login exactly this text part
.*? shortest match over any number of characters
Zum Login exactly this text part
.*?\/a\W\s shortest match to the next /a followed by
a non-word char and a whitespace char
The above match does no valid html checking. But it may be good enough for
you.
Regular Expressions are very powerful and compact, but can become
complicated.
The website's reference section points to further resoures.
A check by xpath comes in more handy here
<verifyxpath
xpath="//a[@href='javascript:go_to_login();']/img[@alt='Zum Login']"
/>
the elements are
// search from root through all nodes
a[@href='bla'] an anchor node with href attribute that has a value of "bla"
/ that has a subnode
img of type img
[@alt='bla'] with alt attribute set to "bla"
The above match does valid html checking. You may want to restrict finding
the anchor node with further refinements.
XPath Expressions are very powerful and compact, but can become complicated.
The website's reference section points to further resoures.
Learning about regular expressions is very helpful when dealing with
text manipulation.
Learning XPath pays off when dealing with XML.
happy testing
Mittie
> -----Original Message-----
> From: webtest-admin@lists.canoo.com
> [mailto:webtest-admin@lists.canoo.com]On Behalf Of Eric Pugh
> Sent: Freitag, 10. Mai 2002 15:50
> To: webtest@gate.canoo.com
> Subject: RE: [Webtest] FW: help
>
>
> Thanks for the post... I am having problems with getting regex to work
> properly ( my lack of understanding!). I have the exact same issue, and
> would love it if someone posts the regex statement or the verifyxpath
> statement they used.
>
> On another note, how do you check a radio button?
>
> Eric
>
> -----Original Message-----
> From: webtest-admin@gate.canoo.com
> [mailto:webtest-admin@gate.canoo.com]On Behalf Of Dierk König
> Sent: Friday, May 10, 2002 8:16 AM
> To: webtest@gate.canoo.com
> Subject: RE: [Webtest] FW: help
>
>
> Hi Heiko,
>
> WebTest cannot test JavaSkript.
>
> Therefore you will not be able to test, that your go_to_login() function
> return the proper String.
>
> But you can test that the anchor calls the login function to determine the
> href.
> (you can use verifytext with regex for this or verifyxpath).
>
> To navigate to the expected href you cannot just follow the link.
> You need to do an explicit invoke step with the expected href.
>
> hope that helps
> Mittie
>
> > -----Original Message-----
> > From: webtest-admin@lists.canoo.com
> > [mailto:webtest-admin@lists.canoo.com]On Behalf Of Dierk König
> > Sent: Freitag, 10. Mai 2002 13:29
> > To: Webtest@Lists. Canoo. Com
> > Subject: [Webtest] FW: help
> >
> >
> >
> >
> > -----Original Message-----
> > From: webtest-owner@lists.canoo.com
> > [mailto:webtest-owner@lists.canoo.com]On Behalf Of Ritzmann, Heiko
> > Sent: Freitag, 10. Mai 2002 11:33
> > To: 'webtest-admin@lists.canoo.com'
> > Subject: WG: help
> >
> >
> >
> >
> > Heiko Ritzmann
> > Software Development
> > GODYO AG
> > Prüssingstraße 35
> > D-07745 Jena
> >
> > e-mail: heiko.ritzmann@godyo.com
> > Telefon: +49 36 41 2 87-2 92
> > Telefax: +49 36 41 2 87-2 87
> > Internet: www.godyo.com
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Ritzmann, Heiko
> > Gesendet: Freitag, 10. Mai 2002 11:24
> > An: 'WebTest-request@lists.canoo.com'
> > Betreff: help
> >
> >
> > Hi,
> >
> > is it possible to test something like the following code with cocoon?
> >
> > ...
> > <script language="JavaScript">
> > function go_to_login(){
> >
> > window.open('login','BauerfeindLogin','width=313,height=176,left=3
> > 00,top=250
> > ');
> > }
> > </script>
> > ...
> > <a href="javascript:go_to_login();" name="toLogin">
> > <img src="../images/bf_logo.gif" border="0" alt="Zum
> > Login"/>
> > </a>
> >
> > If I do a test like this
> >
> > <clicklink stepid="Klick den Link zur Login-Seite" label="Zum
> > Login"/>,
> >
> > I get the error message:
> >
> > "Error encountered:
> > normal(com.canoo.webtest.engine.ConfigurableTestCase): unknown protocol:
> > javascript ..."
> >
> > Thanks
> >
> > Heiko
> >
> >
> >
> >
> >
> >
> >
> >
> > Heiko Ritzmann
> > Software Development
> > GODYO AG
> > Prüssingstraße 35
> > D-07745 Jena
> >
> > e-mail: heiko.ritzmann@godyo.com
> > Telefon: +49 36 41 2 87-2 92
> > Telefax: +49 36 41 2 87-2 87
> > Internet: www.godyo.com
> >
> > _______________________________________________
> > WebTest mailing list
> > WebTest@lists.canoo.com
> > http://lists.canoo.com/mailman/listinfo/webtest
> >
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>
_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest