How to modify / add to Cookie in JMeter?

后端 未结 3 1831
深忆病人
深忆病人 2021-01-14 00:47

I\'m very new to JMeter and need your help on how to modify a cookie.

Here is the scenario: I\'m testing an assessment/test taking website that offers multiple answe

3条回答
  •  醉酒成梦
    2021-01-14 01:42

    I had to implement some changes in the code that worked for me:

    import org.apache.jmeter.protocol.http.control.CookieManager;  
    import org.apache.jmeter.protocol.http.control.Cookie;
    
    CookieManager manager = ctx.getCurrentSampler().getCookieManager();
    Cookie cookie = new Cookie("","","","",false,0, true, true, 0);
    manager.add(cookie);
    

    Following the definition in http://jmeter.apache.org/api/org/apache/jmeter/protocol/http/control/Cookie.html

提交回复
热议问题