Hi,

 

In my webtest, I use a storeXPath statement to extract information from the
web page.

The information in the web-page looks as follows: <TD class="verdanaBlue">74
200&nbsp;kg    </TD>
The information to be extracted must be 74200 without leading and trailing
spaces
 
This looks quite straight-forward, except for filtering the &nbsp; sequence.
>From this topic
http://stackoverflow.com/questions/247135/using-xpath-to-search-text-contain
ing-, I learned that it can be matched by typing Alt+0160 on the NUMERIC
keypad. And indeed, the following xpath expression works in the xpath
section of Mozilla Webtest Recorder:
               translate(normalize-space(//td/text()), 'kg  ', '') where the
blank right after 'kg' is the Alt+0160 and after that a normal space is
added to remove the space between the 74 and the 200.
 
When you apply the string-length command on this result, it returns 5,
ensuring that I have exactly the result I want (74200 without leading and
trailing spaces).
 
However, when I use this xpath in the storeXPath webtest command, there is a
parsing error for that line containing the xpath: Invalid byte 1 of 1-byte
UTF-8 sequence.
 
 
Does anybody have experience in the &nbsp; character and xpath? Is there a
workaround for avoiding the error message in Webtest? Is it maybe a bug?
 
Thanks for the help!
 
David
 
 

 

 

Reply via email to