I am trying to execute ajax calls from JSR223 Sampler like in parallel request using JSR223 Sampler (Jmeter).
I am able to get a response from ajax calls that don't need login auth cookie. However, not getting a response from ajax calls that need auth cookie generated by the login.
I have added login http call before JSR223 sampler but cookie is not getting passed in request. Tried by adding code:
HTTPSamplerProxy previousSampler = ctx.getPreviousSampler();
CookieManager cookieManager = previousSampler.getCookieManager();
HTTPSampleResult previousResult = (HTTPSampleResult)ctx.getPreviousResult();
log.info("Cookie Count is : "+ cookieManager.getCookieCount());
It throws below exception:
2017-11-28 10:44:51,195 ERROR o.a.j.p.j.s.JSR223Sampler: Problem in JSR223 script JSR223 Sampler, message: javax.script.ScriptException: java.lang.NullPointerException: Cannot invoke method getCookieCount() on null object javax.script.ScriptException: java.lang.NullPointerException: Cannot invoke method getCookieCount() on null object