Search code examples
jmeterperformance-testingload-testing

jmeter problem in extracting token from response for vuejs application


I am getting following response from jmeter

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <title>OrangeHRM</title>
      <link rel="icon" href="/web/dist/favicon.ico?1666596668857">
    <link href="/web/dist/css/chunk-vendors.css?1666596668857" rel="preload" as="style">
    <link href="/web/dist/css/app.css?1666596668857" rel="preload" as="style">
    <link href="/web/dist/js/chunk-vendors.js?1666596668857" rel="preload" as="script">
    <link href="/web/dist/js/app.js?1666596668857" rel="preload" as="script">
      <link href="/web/dist/css/chunk-vendors.css?1666596668857" rel="stylesheet"/>
    <link href="/web/dist/css/app.css?1666596668857" rel="stylesheet"/>
</head>
<body>
  <style>
    :root {
            --oxd-primary-one-color:#FF7B1D;
            --oxd-primary-font-color:#FFFFFF;
            --oxd-secondary-four-color:#76BC21;
            --oxd-secondary-font-color:#FFFFFF;
            --oxd-primary-gradient-start-color:#FF920B;
            --oxd-primary-gradient-end-color:#F35C17;
            --oxd-primary-one-lighten-5-color:#ff8a37;
            --oxd-primary-one-lighten-30-color:#ffd4b6;
            --oxd-primary-one-darken-5-color:#ff6c03;
            --oxd-primary-one-alpha-10-color:rgba(255, 123, 29, 0.1);
            --oxd-primary-one-alpha-15-color:rgba(255, 123, 29, 0.15);
            --oxd-primary-one-alpha-20-color:rgba(255, 123, 29, 0.2);
            --oxd-primary-one-alpha-50-color:rgba(255, 123, 29, 0.5);
            --oxd-secondary-four-lighten-5-color:#84d225;
            --oxd-secondary-four-darken-5-color:#68a61d;
            --oxd-secondary-four-alpha-10-color:rgba(118, 188, 33, 0.1);
            --oxd-secondary-four-alpha-15-color:rgba(118, 188, 33, 0.15);
            --oxd-secondary-four-alpha-20-color:rgba(118, 188, 33, 0.2);
            --oxd-secondary-four-alpha-50-color:rgba(118, 188, 33, 0.5);
        }
  </style>
    <noscript>
    </noscript>

    <div id="app">
    <auth-login
            :token="&quot;1.ALvHLiP7IsKYysPpNPVURXr-_LVPJ9JBqIZIaZbLQQQ.R4r3FnSUaqyoj6y5RcA8FBSojIwYEKEW98IkXMz9c3d1jLdWV6tnofqMpA&quot;"
            :login-logo-src="&quot;\/web\/images\/ohrm_logo.png&quot;"
            :login-banner-src="&quot;\/web\/images\/ohrm_branding.png?1666596668857&quot;"
            :show-social-media="true"
            :is-demo-mode="true"
        >
    <template v-slot:footer>
        <div class="orangehrm-copyright-wrapper">
            <oxd-text tag="p" class="orangehrm-copyright">OrangeHRM OS 5.2</oxd-text>
<oxd-text tag="p" class="orangehrm-copyright">&copy; 2005 - 2022 <a href="http://www.orangehrm.com" target="_blank">OrangeHRM, Inc</a>. All rights reserved.</oxd-text>
        </div>
    </template>
    </auth-login>
    </div>
    <script type="text/javascript">
        window.appGlobal = {
            baseUrl: "/web/index.php",
        }
    </script>
    <script src="/web/dist/js/chunk-vendors.js?1666596668857"></script>
    <script src="/web/dist/js/app.js?1666596668857"></script>
</body>
</html>

enter image description here

regex extractor

I want to extract value og :token. I have used xpath extractor , css extractor and regex extractor none of them worked. It is showing null value. It is using vuejs. I have tried to extract token value. I have extracted session from cokkie but could not estract token


Solution

  • The response is not valid XHTML/XML hence you won't be able to use XPath for this.

    I would recommend switching to Boundary Extractor instead:

    enter image description here

    In addition you might want to use __unescapeHtml() function to remove any potential characters which cannot be present in HTML:

    ${__unescapeHtml(${token})}
    

    enter image description here