3
votes

I've recently started to work on Jmeter and my script is failing with 403 error code. I'm using Blazemeter recorded script so Cookie manager is added by default. Also, if I just execute the request on browser it works just fine.

Sampler Result - 
hread Name: Thread Group 1-1
Sample Start: 2018-12-03 14:49:03 AEDT
Load time: 15
Connect Time: 0
Latency: 14
Size in bytes: 1069
Sent bytes:744
Headers size in bytes: 259
Body size in bytes: 810
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: 403
Response message: Forbidden

HTTPSampleResult fields: ContentType: text/html DataEncoding: nu

Request Body GET https://www.tESTwEBSITEtOBEeNETERED.com.au/enable-cookies

GET data:

Cookie Data:
frontend=678e630f5a6f37fc997a718be54f75ba; 
frontend_cid=Ze0Sr0REGmigveWw; 
CUSTOMER_SEGMENT_IDS=deleted; 
CUSTOMER=deleted; 
CUSTOMER_INFO=deleted; 
CUSTOMER_AUTH=deleted; 
CUSTOMER_RATES=deleted; 
CACHED_FRONT_FORM_KEY=AxoMsaUGdvGAQ1N1; 
visid_incap_39856=opEg/ZzKQuCez9glT1rT55OnBFwAAAAAQUIPAAAAAADml4Q7vfuGxMnzp+hJTfV1; 
incap_ses_435_39856=JxltQBT4wVV0t25WbG8JBpOnBFwAAAAA4SHNX9lfr1ZfxCbkdlxKyg==; 
___utmvmiluoDOB=a; 
___utmvailuoDOB=a; 
___utmvbiluoDOB=a

Response data

<html style="height:100%">
    <head>
        <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
        <meta name="format-detection" content="telephone=no">
        <meta name="viewport" content="initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <script type="text/javascript" src="/_Incapsula_Resource?SWJIYLWA=719d34d31c8e3a6e6fffd425f7e032f3"></script>
    </head>
    <body style="margin:0px;height:100%">
        <iframe src="/_Incapsula_Resource?CWUDNSAI=20&xinfo=1-40768151-0%200NNN%20RT%281543808943058%20210%29%20q%280%20-1%20-1%20-1%29%20r%280%20-1%29%20B16%20U5&incident_id=435001350115211124-218735417329125489&edet=16&cinfo=ffffffff" frameborder=0 width="100%" height="100%" marginheight="0px" marginwidth="0px">Request unsuccessful. Incapsula incident ID: 435001350115211124-218735417329125489</iframe>
    </body>
</html>
1
Hi Dmitri, thanks but this is a recorded script using Blazemeter. Also, I'm not using any credentials and adding to cart as guest user. I tried using Jmeter script recorder too. there also recorded script fails at same step i.e. enable cookies. - SSharma

1 Answers

1
votes

If the same request works in browser and doesn't work in JMeter there must be a mismatch in the request headers or parameters.

Modern web applications widely use dynamic request parameters mostly for security reasons, if you haven't performed any correlation - most probably your test scenario fails at login step which have HTTP Status 200 therefore JMeter considers it successful. Inspect the responses of previous samplers using View Results Tree listener to ensure that your test does what it is supposed to be doing and each page matches the expected outcome.