Unable to get value from xml (response)

Hi All, could you please help

I got following kinds of response of API.

5

  <ItemNumber>345158</ItemNumber>

  <RequestQuantity></RequestQuantity>

  <RequestUnitOfMeasure></RequestUnitOfMeasure>

  <RequestNetPrice></RequestNetPrice>

  <RequestExtendedPrice></RequestExtendedPrice>

  <OrderQuantity></OrderQuantity>

  <OrderUnitOfMeasure></OrderUnitOfMeasure>

  <OrderNetPrice></OrderNetPrice>

  <OrderExtendedPrice></OrderExtendedPrice>

  <Warning/>

  <Error/>
... ...

But when I use following method to get the value
WSBuiltInKeywords.verifyElementText(response, ‘mainResult .Row[3].ItemNumber’, ‘345158’, FailureHandling.OPTIONAL)

I got following result:
PM - [WARNING] - Expected text is ‘345158’ but actual element text is:

Seems like that the text value is not get.

I’m not sure the element locator is correct or not. Any suggestions?

BTW
The response contains


Is there any way that can get the count of this element ? So i can write loop case.

Thanks & Regards !
kyle

This post may help

This post is talking about accessing response in HTML. Accessing XML response might be similar, but I have never tried yet.

1 Like

Thanks kazurayam,
Finally I wrote a customer keyword to convert the responseText into xml and get the tag values. I’m not sure whether is an easy way to do this.

1 Like

Good to hear your success.

Just for your interest, I have ever develop a custom keyword to extract texts in HTML and return them as an instance of java.util.List

1 Like