From user-return-39117-apmail-jmeter-user-archive=jmeter.apache.org@jmeter.apache.org Wed Dec 5 20:46:16 2012 Return-Path: X-Original-To: apmail-jmeter-user-archive@www.apache.org Delivered-To: apmail-jmeter-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5AD29D7E4 for ; Wed, 5 Dec 2012 20:46:16 +0000 (UTC) Received: (qmail 3712 invoked by uid 500); 5 Dec 2012 20:46:15 -0000 Delivered-To: apmail-jmeter-user-archive@jmeter.apache.org Received: (qmail 3687 invoked by uid 500); 5 Dec 2012 20:46:15 -0000 Mailing-List: contact user-help@jmeter.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "JMeter Users List" Delivered-To: mailing list user@jmeter.apache.org Received: (qmail 3678 invoked by uid 99); 5 Dec 2012 20:46:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Dec 2012 20:46:15 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of botalov.andrey@gmail.com designates 209.85.217.171 as permitted sender) Received: from [209.85.217.171] (HELO mail-lb0-f171.google.com) (209.85.217.171) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Dec 2012 20:46:10 +0000 Received: by mail-lb0-f171.google.com with SMTP id gf7so4695035lbb.2 for ; Wed, 05 Dec 2012 12:45:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=V9PHKz22sCs1vNH0zSbukWWF3eIkcOES1W+zqXkdU3o=; b=TaAYnNFQNl2LVdZMZ8HWg2l6Rf4c+QbBslff3piPCBrKSaxlDIKe2Ta4sxmIq6dVBe 8/wIYbToC8FnLKIJFW/vH/ibaY3z8/uMvvmZILlATTbcIazfNG+Aes4r+qPJIMxJ58vy c+JQyhOkfi8DX6eypF8XUynW1ZtTVgWRKwk5taMb5SnG+71rJ+wkDdTT8lidxOMGN8Ms k5JmnwDbcwWrGnH9LP/fJqkN2E42HbmhEq/zWI4wsIy87voK0jrCjLerXpqyCH73/Z4N jWh0wLl8Iqo+ZzN99f0fhEDwX5I7diHXnfD/ZLYJzm1XZ9G9OAyVDXT57Lr6Je6ru0s3 0F9w== MIME-Version: 1.0 Received: by 10.152.110.74 with SMTP id hy10mr18162893lab.54.1354740348967; Wed, 05 Dec 2012 12:45:48 -0800 (PST) Received: by 10.112.21.193 with HTTP; Wed, 5 Dec 2012 12:45:48 -0800 (PST) In-Reply-To: References: Date: Wed, 5 Dec 2012 23:45:48 +0300 Message-ID: Subject: Re: How to set cookie that is usually set via Javascript? From: Andrey Botalov To: JMeter Users List Content-Type: multipart/alternative; boundary=bcaec54ee8c8435ad304d021117f X-Virus-Checked: Checked by ClamAV on apache.org --bcaec54ee8c8435ad304d021117f Content-Type: text/plain; charset=ISO-8859-1 On Wed, Dec 5, 2012 at 7:42 PM, Philippe Mouawad wrote: > And script must import classes used: > > The issue was because I hadn't added imports import org.apache.jmeter.protocol.http.control.CookieManager; > import org.apache.jmeter.protocol.http.control.Cookie; > CookieManager manager = sampler.getCookieManager(); > Cookie cookie = new Cookie("toto","titi","www.google.fr","/",false,0); > manager.add(cookie); > > On Wed, Dec 5, 2012 at 5:41 PM, Philippe Mouawad < > philippe.mouawad@gmail.com > > wrote: > > > Hello, > > It works fine except for me, you must look in Request Tab. > > > > Regards > > Philippe > > > > > > On Wed, Dec 5, 2012 at 5:38 PM, Deepak Shetty wrote: > > > >> Will have to check when I have access to a committee.did you import the > >> classes? E.g. cookie? Jmeter.log may have errors check that too > >> On Dec 5, 2012 2:37 AM, "Andrey Botalov" > >> wrote: > >> > >> > On Wed, Dec 5, 2012 at 12:11 AM, Deepak Shetty > >> wrote: > >> > > >> > > can be done in Beanshell or equivalent - get the cookie manager > from > >> the > >> > > Sampler and add the cookie to it > >> > > > >> > > > >> > > > >> > > >> > http://jmeter.apache.org/api/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.html > >> > > > >> > > > >> > > > >> > > I have the following structure: > >> > HTTP Cookie Manager > >> > Thread Group > >> > Beanshell Preprocessor > >> > HTTP Request (with server name www.google.com) > >> > View Results Tree > >> > > >> > Beanshell Preprocessor has script: > >> > manager = sampler.getCookieManager(); > >> > cookie = new Cookie("name","value","www.google.com > >> ","/",false,2000000000); > >> > manager.add(cookie); > >> > > >> > When I execute it no cookies are shown in View Results Tree > >> > > >> > > > >> > > > >> > > On Tue, Dec 4, 2012 at 1:03 PM, Andrey Botalov < > >> botalov.andrey@gmail.com > >> > > >wrote: > >> > > > >> > > > Web application can set cookie via document.cookie. > >> > > > > >> > > > It seems that HTTP Cookie Manager doesn't support this through > >> > > User-defined > >> > > > Cookies as such cookies are common to whole thread group. > >> > > > > >> > > > How can I set such cookie? > >> > > > > >> > > > >> > > >> > > > > > > > > -- > > Cordialement. > > Philippe Mouawad. > > > > > > > > > > > -- > Cordialement. > Philippe Mouawad. > --bcaec54ee8c8435ad304d021117f--