[Webtest] Re: problems with verifyxpath

Christopher Painter-Wakefield webtest@lists.canoo.com
Thu, 29 Apr 2004 13:55:43 -0400

Okay, I can't understand why you are having some of these problems, but
there are a few items I can comment on.

This test:
      <verifyxpath stepid="verify xpath 0.3" text="Logout" xpath="//A"/>
should be failing, I would have thought.  Generally a test for text
("Logout") will fail when you pass in an xpath that resolves to multiple
nodes.  To do text tests, you need to have a very specific xpath
expression, e.g.,
      <verifyxpath xpath="//a[@href='logout.htm']" text="Logout"/>
So I am confused that this test passed!  However, this is probably why
neither of your tests on the text "Sposta su" pass.

Otherwise, I can't explain the failures you are getting.  In particular, I
don't understand why //A would pass and //a would fail (and same with IMG
and img); this makes no sense.  I ran your html through one version of
jTidy, and it left the a's as a's, not A's.  You should ask webtest to save
the html result (saveresponse="true" in your config element).  Webtest
saves the result after passing through jTidy, so this is the best file to
look at (rather than your raw html below).  If it has A's, then that tells
you something.  If it has capitalized these elements, then you probably
have a buggy version of jTidy in your class path.  Try either a newer or an
older Tidy.jar.

(If you are not saving the result, is it possible that webtest is *not*
seeing the html below?  Could it be seeing an error page instead?)

If that isn't the problem, then it is possible the problem is occurring
elsewhere altogether.  Sometimes webtest incorrectly reports the actual
location of an error, although I've noticed this more when using the
various form setting and verifying steps.  See if you can cut your webtest
down to two steps, an invoke and a failing webtest.  If you can't explain
why the webtest is failing, try cutting your html down to the smallest
amount that contains the elements you want to test.  Maybe webtest or tidy
is choking on something specific in the html.  If you can narrow it down
more, you might find a change that will make things work, or you might have
enough information for a bug report to this list.

Sorry I can't be more help!  Good luck,

   Message: 10
   Date: Thu, 29 Apr 2004 09:24:55 +0200
   From: Massimiliano Mauri <massimiliano.mauri@wise-lab.it>
   To: webtest@lists.canoo.com
   Subject: Re: [Webtest] Re: problems with verifyxpath
   Reply-To: webtest@lists.canoo.com

   >I can't get your attachments because they are encoded in ASCII in the
   >digest, and my e-mail client doesn't recognize it.  Can you just put
   >in your reply?  Best (and this is just good debugging practice), make a
   >page and test script that are as small as possible while still
   >the problem.  (You might find the problem this way, too.)  Then copy
   >text of these small files into your reply.

   the html compiled page is the following :


   Some test performed  in this page are:
   <verifyxpath stepid="verify xpath 0.1" xpath="//A"/> PASSED;
   <verifyxpath stepid="verify xpath 3.1" xpath="//a"/>   FAILED;

   <verifyxpath stepid="verify xpath 0.2"
   xpath="//A[@href='index.jsp?_cid=ba72735&amp;_crc=19302dc']"/> PASSED;
   <verifyxpath stepid="verify xpath 0.3" text="Logout" xpath="//A"/>
   <verifyxpath stepid="verify xpath 0.4" xpath="//A[@href='muovi.jsp']"/>
   <verifyxpath stepid="verify xpath 0.5"
   xpath="//a[@href='muovi.jsp']"/>   FAILED;

   <verifyxpath stepid="verify xpath 1.1" text="Sposta su" xpath="//A"/>
   <verifyxpath stepid="verify xpath 4.1" text="Sposta su" xpath="//a"/>

   <verifyxpath stepid="verify xpath 2.1" xpath="//IMG"/>   PASSED;
   <verifyxpath stepid="verify xpath 2.2"
   xpath="//IMG[@src='/res/tree/modifica.gif']"/> PASSED;
   <verifyxpath stepid="verify xpath 2.3" xpath="//img"/>   FAILED;

   >Another question: see the report of test 2 and 6:
   >I'm searching a link
   >with label "Sposta su" ("Move up") in the page. This link exists in the
   >page, but the test fails (with xpath="//A" and with xpath="//a"). Why?
   >because is in a "bad table"?
   (test 2 and 6 are the verifyxpath with stepid "verify xpath 1.1" and
   "verify xpath 4.1")