[Token] 从index.jsp中获取Token

import com.eviware.soapui.support.GroovyUtils

 

def groovyUtils = new GroovyUtils( context )

def holder = groovyUtils.getXmlHolder( "Get Token#Response" )

 

String tokenTemp = holder.getNodeValue("//html[1]/body[1]/script[1]/text()")

log.info "tokenTemp = "+tokenTemp



String token = tokenTemp.split("var token = ")[1].split("\"")[1]

log.info "token = "+token

 

testRunner.testCase.testSuite.project.setPropertyValue( "token", token )

 

你可能感兴趣的:(index)