Forum Discussion

Mis3's avatar
Mis3
Frequent Contributor
4 years ago

Groovy: Fails to Display Request Status

I am building a Groovy script to read an external file and execute a testStep one by one. Somehow log.info can successfully display the data (basicMSISDN, NAM, etc) of the XML response but not the r...
  • nmrao's avatar
    4 years ago

    Mis3 

    Oh, I got what you are point now.

     

    You are trying to access the attributes of a node. The xpath is incorrect, that is why data is not shown for you.

    Attributes are accessed using @Attribute

     

    Here is another simple way of accessing xml data using XmlSlurper. If you notice, the data is accessed dot(.) after node name, then dot (.) and node name like how we see.

    NOTE: you can replace printf with log.info