Hi Patrick,

this is an illustration of the changes in XPath processing. On one side
the untrimmed value is the correct value and is what you would see if
you use for instance an XPath tool within Firefox. On the other side,
the normal use case is probably to trim the value and ignore multiple
spaces which what was done up to HtmlUnit-1.14.
I'm not sure what is the best way to take. Perhaps add a "verification
mode" attribute to verifyXPath (and probably other verifyXxxx too) with
a default value of "trim"?

Cheers,
Marc.
-- 
Blog: http://mguillem.wordpress.com


Parkin Roman wrote:
> Hi,
> 
> Sorry, solution is found
> 
> See selftest for verifyXPath:
> <verifyXPath xpath="wt:cleanText(//[EMAIL PROTECTED]'cleantText1'])" 
> text="some
> text with spaces and new lines"/>
> 
> In my case
> <verifyXPath text="Open"
> xpath="wt:cleanText(//[EMAIL PROTECTED]'providerForm:j_id204:status'])" />
> 
> Thank you Marc for nice examples
> 
> Regards,
> Roman
> 
> 
> Parkin Roman:
>> Hi
>> I have the following problem after upgrade to new webtest version:
>>
>> Html code
>>
>> <tr>
>> <td><div id="providerForm:j_id204">
>>
>>    <p><label class="">
>> Status</label>
>>
>>        <span class=""><label id="providerForm:j_id204:status">
>> Open</label>
>>        </span>
>>
>>    </p></div></td>
>> </tr>
>>
>> I am trying to check 'Open' by:
>>
>> <verifyXPath text="Open"
>> xpath="//[EMAIL PROTECTED]'providerForm:j_id204:status']" />
>>
>> But i get the error:
>>
>> <h3>Details</h3>
>> <table>
>> <tbody>
>> <tr>
>> <td class="detailName">expected value</td><td
>> class="detailText">Open</td>
>>
>> </tr>
>> <tr>
>> <td class="detailName">actual value</td><td class="detailText">
>> Open</td>
>>
>> How to resolve it?
>>
>> Thank you
>>
>>
>>
>> Marc Guillemot:
>>> *Warning: possible fixes needed in XPath usage*
>>>
>>> HtmlUnit doesn't use Jaxen with a custom document navigator anymore for
>>> XPath processing but Xalan with standard DOM node navigation. This has
>>> different consequences:
>>>
>>> - shortcuts to verify text content of a node don't work anymore
>>> ex: //tr[td = '2.1'] should be replaced for instance with //tr[td/text()
>>> = '2.1']
>>>
>>> - spaces are not trimmed in text
>>> ex: if the text of the above td is "  2.1", the XPath expression should
>>> be changed to //tr[td/text() = '  2.1']. Alternatively you can use the
>>> wt:cleanText function //tr[wt:cleanText(td) = '2.1']
>>>
>>> - syntax check is less forgiving: I've seen some cases of invalid xpath
>>> expressions (for instance with a ")" instead of a "]") that were
>>> accepted previously but that are not accepted anymore.
>>>
>>> Your feedback is welcome.
>>>
>>> Happy testing,
>>> Marc.
>>>   
>> _______________________________________________
>> WebTest mailing list
>> [email protected]
>> http://lists.canoo.com/mailman/listinfo/webtest
> _______________________________________________
> 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