Forum Discussion

anand1's avatar
anand1
Contributor
12 years ago

[Resolved] Using XPATH Assertions

In my test case I am getting the response as
<data contentType="text/plain; charset=utf-8" contentLength="25"><![CDATA[This is a valid text.
]]></data>
Problem is: I need to assert the the message content using the xpath match, however in the response at the end there is a new line character, due to which my XPATH assertion is getting failed.

Kindly suggest a way by which I can ignore the new line character, as I have to match the content of the string only.

Looking forward for your response.

13 Replies

  • Thanks a lot for sharing this piece of information..
  • Mr. Rao,

    It was my bad as I said that it worked, actually the string //*:data/text() only works when I am selecting the Allow Wildcards Option, else it is getting failed.
    In my scenario I feel that allowing wildcard is a bit riskier for me, & I would like to avoid it.
    My original output is
    <data contentType="text/plain; charset=utf-8" contentLength="149"><![CDATA[The length of the value must fall within the range "0" (Ignore) - "64" (Inclusive).
    ]]></data>
    At the end of this String there is a new line character due to which XPATH is not matching.
    So how should I go about the same in case i would like to use XPATH only.

    Thanks,
    Anand
  • Mr.Rao,

    Can you please help us in the same....or someone from the support team.

    Thanks,
    Anand