jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrey Botalov <botalov.and...@gmail.com>
Subject Re: How to set cookie that is usually set via Javascript?
Date Wed, 05 Dec 2012 20:45:48 GMT
On Wed, Dec 5, 2012 at 7:42 PM, Philippe Mouawad <philippe.mouawad@gmail.com
> 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 <shettyd@gmail.com> 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" <botalov.andrey@gmail.com>
> >> wrote:
> >>
> >> > On Wed, Dec 5, 2012 at 12:11 AM, Deepak Shetty <shettyd@gmail.com>
> >> 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.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message