Forum Discussion

Bishal's avatar
Bishal
Contributor
8 years ago
Solved

How to Remove extra [] from the Xpath Expression Response.

Hi,

I am using XPath Assertion to compare expected value vs actual

 

Actual

XPath Assertion

//Response[1]/e/columns --- This provides concat values for all the nodes = column under Response/e . But, it gives extra []. Output = [[4.321808818872719,-22.80283626539684,6.0452621008568075,-15.671138277860097]]

 

Is there's a way to remove extra []?

 

My expected value is something like this. This uses "ResponseAsXML" 

 

[4.321808818872719,-22.80283626539684,6.0452621008568075,-15.671138277860097]

 

  • This issue is fixed.

     

    //Response[1]/e/columns -------- this was giving me an issue with extra []

     

    So , i changed it to

     

    string-join(//Response[1]/e/columns/text(),',') --- This helped me to remove an extra []

3 Replies

  • KarelHusa's avatar
    KarelHusa
    Champion Level 3

    It would help if you also post an XML document you are checking.

     

    Karel

     

  • nmrao's avatar
    nmrao
    Champion Level 3
    That could be because, result is list.
  • This issue is fixed.

     

    //Response[1]/e/columns -------- this was giving me an issue with extra []

     

    So , i changed it to

     

    string-join(//Response[1]/e/columns/text(),',') --- This helped me to remove an extra []