Forum Discussion

fa's avatar
fa
Occasional Contributor
7 years ago

XmlSlurper/XmlParser to store data from HTML content

Hello,   I am a new user of SoapUI community version (5.0.0). I need to store the action value from the (HTML) response (below):   <html> <head> <meta content="HTML Tidy for Java (vers....
  • PaulMS's avatar
    PaulMS
    7 years ago

    SoapUI has already converted HTML to standard XML format (with closed tags). By changing the script to responseContentAsXml you could get the action value

     

    import groovy.util.XmlSlurper;
    
    def response = messageExchange.responseContentAsXml;
    def slurper = new XmlSlurper();
    def xmldata = slurper.parseText response;

    def action = xmldata.body.form.@action
    log.info action