xpath Query for xpath extractor of Jmeter

£可爱£侵袭症+ 提交于 2019-12-23 01:57:08

问题


Can someone please provide me the xml query for retrieving the value of sessionId from the below response:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:createUserResponse xmlns:ns2="http://www.musicthp.com"     
                    isNewUser="false"
                    profileId="32109" 
                    sessionId="ryIlb+E5yj7FReA2w96uag=="
                    success="true">
<duration>316</duration>
</ns2:createUserResponse>

I tried using /ns2:createUserResponse/@sessionId and seems its not returning anything. I want to use this query in the XPATH extractor of jmeter. My requirement: I need to retrieve sessionId value using xpath extractor and use that value in the successive requests.

Thanks for your help in advance


回答1:


Have you set JMeter to use namespaces?

JMeter has been reported to have problems with namespaces. If fiddling with settings won't help, here is a workaround for the root element

/*/@sessionId

Workaround for any element in a namespace is to use *[local-name() = 'element'] instead of prefix:element



来源:https://stackoverflow.com/questions/6201472/xpath-query-for-xpath-extractor-of-jmeter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!